pipenv: ERROR: No matching distribution found for torch==1.11.0+cu113 when using --extra-index-url
It seems that this error is also a problem when installing from other sources, such as in #5021.
Issue description
After lots of debugging and trial and error, we have run into a bug with pipenv relating to installing libraries while using another index url (–extra-index-url).
When trying to install PyTorch using the following command pipenv install --extra-index-url https://download.pytorch.org/whl/cu113/ "torch==1.11.0+cu113" Installing torch==1.11.0+cu113, as specified under this issue: https://github.com/pypa/pipenv/issues/4961, we get the following error: ERROR: No matching distribution found for torch==1.11.0+cu113.
According to @Bananaman this was possible to do in a previous version of pipenv.
Expected result
Expected an installation using a 3rd party index url, in this case PyTorch.
Actual result
daniel@daniel-desktop:~/Documents$ pipenv install --extra-index-url https://download.pytorch.org/whl/cu113/ "torch==1.11.0+cu113"
Installing torch==1.11.0+cu113...
Adding torch to Pipfile's [packages]...
✔ Installation Succeeded
Pipfile.lock (db4242) out of date, updating to (7d86a3)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
CRITICAL:pipenv.patched.notpip._internal.resolution.resolvelib.factory:Could not find a version that satisfies the requirement torch==1.11.0+cu113 (from versions: 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.10.2, 1.11.0)
[ResolutionFailure]: File "/home/daniel/.local/lib/python3.8/site-packages/pipenv/resolver.py", line 743, in _main
[ResolutionFailure]: resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]: File "/home/daniel/.local/lib/python3.8/site-packages/pipenv/resolver.py", line 704, in resolve_packages
[ResolutionFailure]: results, resolver = resolve(
[ResolutionFailure]: File "/home/daniel/.local/lib/python3.8/site-packages/pipenv/resolver.py", line 685, in resolve
[ResolutionFailure]: return resolve_deps(
[ResolutionFailure]: File "/home/daniel/.local/lib/python3.8/site-packages/pipenv/utils.py", line 1398, in resolve_deps
[ResolutionFailure]: results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]: File "/home/daniel/.local/lib/python3.8/site-packages/pipenv/utils.py", line 1127, in actually_resolve_deps
[ResolutionFailure]: resolver.resolve()
[ResolutionFailure]: File "/home/daniel/.local/lib/python3.8/site-packages/pipenv/utils.py", line 905, in resolve
[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.
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: No matching distribution found for torch==1.11.0+cu113
Steps to replicate
Be sure to use the latest version of pipenv, if I use a previous version (latest confirmed is 2022.1.8) the error goes away.
- Create clean environment
pipenv install --extra-index-url https://download.pytorch.org/whl/cu113/ "torch==1.11.0+cu113"- Error should appear on latest version of pipenv
$ pipenv --support
Pipenv version: '2022.3.28'
Pipenv location: '/home/daniel/.local/lib/python3.8/site-packages/pipenv'
Python location: '/usr/bin/python3'
Python installations found:
3.8.12:/home/daniel/.pyenv/versions/3.8.12/bin/python3.8.10:/usr/bin/python33.8.10:/usr/bin/python3.83.8.10:/bin/python33.8.10:/bin/python3.8
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.8.10',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '5.13.0-37-generic',
'platform_system': 'Linux',
'platform_version': '#42~20.04.1-Ubuntu SMP Tue Mar 15 15:44:28 UTC 2022',
'python_full_version': '3.8.10',
'python_version': '3.8',
'sys_platform': 'linux'}
System environment variables:
SHELLSESSION_MANAGERQT_ACCESSIBILITYCOLORTERMPYENV_SHELLXDG_CONFIG_DIRSXDG_MENU_PREFIXGNOME_DESKTOP_SESSION_IDMANDATORY_PATHLC_ADDRESSGNOME_SHELL_SESSION_MODELC_NAMESSH_AUTH_SOCKXMODIFIERSDESKTOP_SESSIONLC_MONETARYSSH_AGENT_PIDGTK_MODULESPWDLOGNAMEXDG_SESSION_DESKTOPXDG_SESSION_TYPEGPG_AGENT_INFOXAUTHORITYGJS_DEBUG_TOPICSWINDOWPATHHOMEUSERNAMEIM_CONFIG_PHASELC_PAPERLANGLS_COLORSXDG_CURRENT_DESKTOPVTE_VERSIONGNOME_TERMINAL_SCREENINVOCATION_IDMANAGERPIDGJS_DEBUG_OUTPUTLESSCLOSEXDG_SESSION_CLASSSETUPTOOLS_USE_DISTUTILSTERMLC_IDENTIFICATIONDEFAULTS_PATHLESSOPENUSERGNOME_TERMINAL_SERVICEDISPLAYSHLVLLC_TELEPHONEQT_IM_MODULELC_MEASUREMENTLD_LIBRARY_PATHXDG_RUNTIME_DIRPYENV_ROOTLC_TIMEJOURNAL_STREAMXDG_DATA_DIRSPATHGDMSESSIONDBUS_SESSION_BUS_ADDRESSLC_NUMERICOLDPWD_PIP_SHIMS_BASE_MODULEPIP_DISABLE_PIP_VERSION_CHECKPYTHONDONTWRITEBYTECODEPIP_PYTHON_PATHPYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH:/home/daniel/.pyenv/shims:/home/daniel/.pyenv/bin:/usr/local/cuda-11.3/bin:/home/daniel/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/binSHELL:/bin/bashLANG:en_US.UTF-8PWD:/home/daniel/Documents
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 25 (12 by maintainers)
Also, I just checked the wheel archive
torch-1.11.0+cu113-cp310-cp310-win_amd64.whland I don’t see where it would ever figure out that it need numpy implicitly – probably something you always have to manually install or add to the Pipfile as well I am guessing with that particular archive.Thanks for confirming this @DanielPerezJensen – I have a commit that ensure that the 1-hash that gets installed for “torch” or other index restricted packages gets included, but I’ve had more difficulties getting it to include all 8 hashes again. I think the ideal, would be it includes the two hashes that match your required python_version or all of them (all 8) if a version is not specified. I will be looking to find more time to look into this, at a minimum will ship new version in April that includes at least the matching hash, but ideally will figure out how to include all the relevant hashes as well for private index restricted packages.
@matteius
Running
pipenv install "torch==1.11.0+cu113" --index https://download.pytorch.org/whl/cu113/ -vyields the following pip command:/home/daniel/.local/share/virtualenvs/test-Kb_OZVBf/bin/python -m pip install --verbose --upgrade --exists-action=i -r /tmp/pipenv-zz18ayop-requirements/pipenv-edwy4lp9-requirement.txt -i https://download.pytorch.org/whl/cu113/ --extra-index-url https://pypi.org/simple --extra-index-url https://pypi.org/simple. This is with Python 3.8.12, and pipenv 2022.3.28.The verbose output is this:
With the following Pipfile:
Importing torch
python -c "import torch"yields:The numpy dependency not being installed is a “problem” that I have seen many times when installing PyTorch through their index. Installing numpy solves the issue and torch can be imported.
Furthermore running some test code to verify that the gpu is being used shows that indeed the GPU is getting used.