事象
Pipenvでパッケージをインストールするためにpipenv install <パッケージ名>
コマンドを実行したら、以下のように「No matching distribution found for <パッケージ名>」エラーとなった。
$ pipenv install urllib==1.25
Installing urllib==1.25…
Adding urllib to Pipfile's [packages]…
✔ Installation Succeeded
Pipfile.lock (dff900) out of date, updating to (ca72e7)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✘ Locking Failed!
CRITICAL:pipenv.patched.notpip._internal.index:Could not find a version that satisfies the requirement urllib==1.25 (from versions: )
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 85, in _main
[pipenv.exceptions.ResolutionFailure]: requirements_dir=requirements_dir,
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 69, in resolve
[pipenv.exceptions.ResolutionFailure]: req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]: req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]: resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]: raise ResolutionFailure(message=str(e))
[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: No matching distribution found for urllib==1.25
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 85, in _main
[pipenv.exceptions.ResolutionFailure]: requirements_dir=requirements_dir,
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 69, in resolve
[pipenv.exceptions.ResolutionFailure]: req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]: req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]: resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]: File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]: raise ResolutionFailure(message=str(e))
[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: No matching distribution found for urllib==1.25
原因・解決
パッケージ名を間違えていたいことが原因だった。
- 誤:
urllib==1.25
- 正:
urllib3==1.25
正しいパッケージ名を指定したら正常にパッケージをインストールできた。
$ pipenv install urllib3==1.25
Creating a Pipfile for this project…
Installing urllib3==1.25…
Adding urllib3 to Pipfile's [packages]…
✔ Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✔ Success!
Updated Pipfile.lock (053760)!
Installing dependencies from Pipfile.lock (053760)…
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00
以上