LoginSignup
7
4

More than 3 years have passed since last update.

pipenv で "No versions found" というエラーが出た場合の対処法

Posted at

事象:pipenv を使ったパッケージのインストール時のエラー

pipenv を使って以下のようにインストールを試みたところ

pipenv install <package name>

以下のように怒られてしまった。

[pipenv.exceptions.ResolutionFailure]:       pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches request
[pipenv.exceptions.ResolutionFailure]:       No versions found
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches request
No versions found
Was https://pypi.org/simple reachable?

原因

pipenv が使う pip の SSL 認証がうまく行っていないのが原因らしい。
普通に pip install をしていたときも

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)

などと怒られていたので、暫定対処として

pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host <package name>

としてお茶を濁していたが、pipenv では上記のオプションを付けることができない模様

対処法

pipの設定ファイルであるpip.confに必要な設定をすることで解決できる。
Mac の場合

mkdir ~/.pip
vim ~/.pip/pip.conf

として

pip.conf
[global]
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org

を作ってあげれば良い。
それ以外の環境の場合、参考にした https://qiita.com/agajo/items/73d6f14855da703972e0 を見ると良い。

7
4
1

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
7
4