2

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:

http://artifactory.bigcompany:8081/artifactory/pypi_repo/numpy/numpy-1.12.1%20mkl-cp35-cp35m-win_amd64.whl

So is there any way in Pip to specify an artifact which has a space in the artifact's version number?

Salim Fadhley
  • 6,975
  • 14
  • 46
  • 83
  • One solution would be to use Anaconda, which likely comes with that library – OneCricketeer Jun 07 '17 at 12:04
  • Possible duplicate of [How to install numpy+mkl for python 2.7 on windows 64 bit?](https://stackoverflow.com/questions/41217793/how-to-install-numpymkl-for-python-2-7-on-windows-64-bit) – OneCricketeer Jun 07 '17 at 12:06
  • It's the same package but not the same question. The key difference here is that I've re-hosted the package on a corporate Artifactory (like a private version of PyPi). The problem is that the UCI package names are by default a bit non-conventional. Can I pip install them without renaming them? – Salim Fadhley Jun 07 '17 at 12:21
  • Sorry - can't use Anaconda. We are committed to "normal" python. – Salim Fadhley Jun 07 '17 at 12:21
  • Why can't you just download the whl file and rename? I think that spaces aren't possible in pip packages – OneCricketeer Jun 07 '17 at 12:24
  • Yes, that was one of the work-arounds I listed in the text. I can do that and I have done that, but I'd prefer to be able to request these packages in a way that's consistent with what the publisher intended. – Salim Fadhley Jun 07 '17 at 12:42
  • Does this look like your problem? https://www.jfrog.com/jira/browse/RTFACT-9968 – OneCricketeer Jun 07 '17 at 15:43
  • Have you thought of automating manual steps with fabric? – oshaiken Jun 07 '17 at 18:05

0 Answers0