Skip to content

pip install --target ignores platlib directories #3682

@chandu-atina

Description

@chandu-atina
  • Pip version: 8.1.2
  • Python version: 2.7.5
  • Operating System: centos7 64 bit

Description:

pip install with --target option has an issue with lib64 packages(platlib).

  1. When I tried to install mysql-python using the following command, I ran into an error saying no such file or directory.

pip install --target=/var/tmp/ mysql-python

Issue:
The issue is that the package is installed in platlib directory " /tmp/{random_string}/lib64/python " but pip is trying to move files only from purelib directory to target directory but not platlib directory. So it checks for directories under "/tmp/{random_string}/lib/python" and throws exception saying no such file or directory.

  1. When I tried to install paramiko==1.16.0 using the following command, I found pycrypto package is missing which is a dependent package for paramiko.

`pip install --target=/var/tmp/paramiko paramiko==1.16.0``

Issue:
There are three packages (paramiko, ecdsa, pycrypto) that are installed in /tmp/{random_string} directory. paramiko and ecdsa are installed in purelib "/tmp/{random_string}/lib/python" and pycrypto is installed in platlib "/tmp/{random_string}/lib64/python" which is expected based on system architecture. But pip moves files under purelib to target directory but not files under platlib, as a result pycrypto packages in missing. Moreover the success message says "Successfully installed ecdsa-0.13 paramiko-1.16.0 pycrypto-2.6.1"

What I've run:

pip install --target=/var/tmp/ mysql-python

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 368, in run
    for item in os.listdir(lib_dir):
OSError: [Errno 2] No such file or directory: '/tmp/tmpbtxE72/lib/python'
pip install --target=/var/tmp/paramiko paramiko==1.16.0
Collecting paramiko==1.16.0
  Using cached paramiko-1.16.0-py2.py3-none-any.whl
Collecting ecdsa>=0.11 (from paramiko==1.16.0)
  Using cached ecdsa-0.13-py2.py3-none-any.whl
Collecting pycrypto!=2.4,>=2.1 (from paramiko==1.16.0)
  Using cached pycrypto-2.6.1.tar.gz
Installing collected packages: ecdsa, pycrypto, paramiko
  Running setup.py install for pycrypto ... done
Successfully installed ecdsa-0.13 paramiko-1.16.0 pycrypto-2.6.1

Note:

I'm planning to fix this and raise a pull request so that pip considers both purelib as well as platlib (if both are different and exists)

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-lockedOutdated issues that have been locked by automation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions