I want to install a Python wheel that I obtained from a 3rd party (Numpy with MKL extensions precompiled for Windows 64). I've re-hosted this package on Artifactory (think of it as a private, enterprisey version of PyPi that works behind a firewall). I'd like users to be able to just pip-install these packages as they would any other package.
Of course the easy work-around is to manually download the file and then pip install it, however that's not very satisfying because it means we have to treat these packages as special cases. I can't use Python's normal dependency management process.
Another obvious work-around would be to rename the file before uploading it: I could remove the space. That would work, but has the problem of introducing additional manual steps into the process next time somebody wants to upgrade these packages.
The problem is that while the Pip utility can see files with spaces in the version, there seems to be no way to actually request these files:
When pip lists the available versions it can see "1.12.1 mkl", that's with a space before "mkl". Unfortunately the space character does not seem to be permitted in requirement specs:
> pip install numpy==1.13.0rc2+mkl
Collecting numpy==1.13.0rc2+mkl
Could not find a version that satisfies the requirement numpy==1.13.0rc2+mkl (from versions: 1.12.1 mkl, 1.13.0rc2 mkl, 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0b3, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.11.1rc1, 1.11.1, 1.11.2rc1, 1.11.2, 1.11.3, 1.12.0b1, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.1rc1, 1.12.1, 1.13.0rc1, 1.13.0rc2)
No matching distribution found for numpy==1.13.0rc2+mkl
^^ Scroll to the right here --->
This obviously isn't the right way to do it:
> pip install numpy=='1.13.0rc2 mkl'
Invalid requirement: 'numpy=='1.13.0rc2'
Traceback (most recent call last):
File "c:\apps\venv_demo\lib\site-packages\pip\req\req_install.py", line 77, in __init__
req = pkg_resources.Requirement.parse(req)
File "c:\apps\venv_demo\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 3036, in parse
req, = parse_requirements(s)
File "c:\apps\venv_demo\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2980, in parse_requirements
"version spec")
File "c:\apps\venv_demo\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2945, in scan_list
raise RequirementParseError(msg, line, "at", line[p:])
pip._vendor.pkg_resources.RequirementParseError: Expected version spec in numpy=='1.13.0rc2 at =='1.13.0rc2
Nor are any of the following:
pip install numpy==1.13.0rc2_mkl
pip install numpy==1.13.0rc2-mkl
pip install numpy==1.13.0rc2\ mkl
The artifact is actually being served from an Artifactory which proxies PyPi so that machines which don't or can't have a compiler can download a specific binary version of the numpy Wheel. The path of the installable file is actually:
So is there any way in Pip to specify an artifact which has a space in the artifact's version number?