0
0

OCI CLIインストール時の「No such file or directory」エラーの解決方法

Posted at

OCI CLIインストール時の「No such file or directory」エラーの解決方法(Windows 11 Home対応)

はじめに

Oracle Cloud Infrastructure (OCI) CLIをWindows環境にインストールする(pip install oci-cli実行の)際、以下のようなエラーに遭遇することがあります。

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\...\\Python39\\Lib\\site-packages\\oci_cli\\help_text_producer\\data_files\\man\\database-management_managed-database_enable-external-container-database-management-feature-external-database-diagnostics-and-management-feature-details.1'
HINT: This error might have occurred since this system does not have Windows Long Path support enabled.

この記事では、このエラーの原因と解決方法を説明します。

エラーの原因

このエラーは主に以下の理由で発生します:

  1. Windowsのロングパスサポートが無効になっている
  2. ファイルパスが260文字の制限を超えている

解決方法

1. Windowsのロングパスサポートを有効にする

Windows 11 Pro/Enterprise/Educationの場合:

  1. 管理者権限でPowerShellを開く
  2. 以下のコマンドを実行:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1
  1. PCを再起動

Windows 11 Homeの場合:

  1. Windowsキー + R を押して「ファイル名を指定して実行」を開く
  2. regedit と入力し、OKをクリック
  3. レジストリエディタで以下のパスに移動:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
  4. 右ペインで LongPathsEnabled を探す
    • 存在しない場合:右クリック → 新規 → DWORD (32ビット) 値 を選択し、名前を LongPathsEnabled とする
  5. LongPathsEnabled をダブルクリックし、値のデータを 1 に設定
  6. OKをクリックしてレジストリエディタを閉じる
  7. PCを再起動

2. インストールディレクトリの変更

上記の方法で解決しない場合:

  1. 短いパスにインストールを試みる:
$env:ORACLE_PATH = "C:\oci-cli"
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1'))

まとめ

これらの方法でOCI CLIのインストールエラーが解決できるはずです。ロングパスサポートを有効にすることで、他のアプリケーションでも長いファイルパスを扱えるようになるため、一般的なWindowsの使用においても有用です。

注意点

  • レジストリの編集は慎重に行ってください
  • Windows 11 Homeでは、グループポリシーエディタ(gpedit.msc)が利用できないため、レジストリを直接編集する必要があります
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0