Pip Is Able To Search Package But Install Fails With Error
Solution 1:
Two most common problems when facing this issue are either platform mismatch or python version mismatch.
python version check
Check what python version your default pip
refers to - is it the python3.5
's pip
?
$ pip -V | grep -o "(.*)"
will give you the info. If default pip
refers to some other python version, invoke the python3.5
's pip
directly with pip3.5
:
$ pip3.5 install -i https://localhost --trusted-host localhost cffi==1.11.4
platform check
Try explicitly downloading the cffi
package for the manylinux1_x86_64
platform - will the wheel download?
$ pip download cffi --only-binary=:all: --platform manylinux1_x86_64 -i https://localhost --trusted-host localhost
If the download succeeds, you have a platform mismatch on your target machine. Check what platform is recognized by pip
:
$ python3.5 -c "import pip; print(pip.pep425tags.get_platform())"
ABI check
A less common problem is the ABI mismatch: you can check your platform's ABI with
$ python3.5 -c "import pip; print(pip.pep425tags.get_abi_tag())"
This string should match the prefix in the wheel name that comes before the platform tag, so in your case, your ABI should be cp35m
.
If you get the macosx_10_13_x86_64
platform tag, this means you have MacOS High Sierra. On your local PyPI server, you have uploaded the cffi
wheel that can be installed on linux only (manylinux
wheel). You won't be able to install it on MacOS High Sierra. The thing is, cffi
package ships code partly written in C and compiled for the target platform only. You have three possibilities to solve this:
- The simplest solution: download the
macosx_10_13_x86_64
wheel from PyPI and upload it to your local server alongside themanylinux1
wheel. Now the linux client will get the wheel compiled for linux and you will get the wheel compiled for MacOS when runningpip install cffi
. - The "DIY" solution: download the source tar installer from PyPI and upload it to your local server alongside the
manylinux1
wheel. Now the linux client will get the compiled wheel and MacOS and Windows clients will get the source tar, where they are forced to compile the contained C code locally - if the OS does not provide the right tools, the installation will fail. - Configure the local server to proxy the PyPI: if a package is requested, but not found on your local server, it passes the request through to the
pypi.python.org
and if the package is found in the public repository, it is downloaded and passed through your local server as if was found there. Not sure, however, if your server supports this feature. We usedevpi
where it is enough to tell your index that it should haveroot/pypi
among its bases:devpi index -m user/index bases=root/pypi
.
Note that these solutions are not mutually excluding: you can combine 1 with 2 (linux clients will get manylinux1
wheels, High Sierra gets macos_10_13
wheel, the rest get the source tar) and even 1, 2 and 3 alltogether. It all depends on what you want/need/can to upload and maintain on your local server.
Post a Comment for "Pip Is Able To Search Package But Install Fails With Error"