8

I've been having an odd problem with pip on Ubuntu 15.04. When I try to install anything using the "-t" option to put it in a specific directory, it fails with the following error:

error: can't combine user with prefix, exec_prefix/home, or install_(plat)base

For instance, pip install -t <directory> <package> fails with this error.

My pip is version 1.5.6, and my Python version is 2.7.

I've run the exact same commands on my 14.10 systems with no issues, so I can only conclude that this is a problem which is particular to 15.04.

1
  • Edit your question and add your command "to install anything using the "-t" option".
    – A.B.
    May 6 '15 at 6:03
8

I ran into the same problem and what I noticed is that the pip in the default distro is old 1.5.6 the current released version being 7.1.0. Since is hard to track down the issue, looking there and there for the "needle in a hay stack" I removed it and installed it manually as suggested in the following :

This comment : https://github.com/pypa/pip/issues/1093#issuecomment-103127883 referenced in this stack: https://stackoverflow.com/questions/19460232/pip-list-crashes-with-an-assertionerror

Remove pip:

sudo apt-get remove --auto-remove python-pip

Download the install script :

wget https://bootstrap.pypa.io/get-pip.py

Install it back:

sudo python get-pip.py

Link commands to bin :

sudo ln -s [PIP_HOME]/bin/pip /usr/local/bin/pip
sudo ln -s [PIP_HOME]/bin/wheel /usr/local/bin/wheel
sudo ln -s [PIP_HOME]/bin/easy_install /usr/local/bin/easy_install

Where [PIP_HOME] is the directory of the pip package.

now when I run pip -V puts out :

pip 7.1.0 from /home/tiberiu/.local/lib/python2.7/site-packages (python 2.7)

Back to my root problem the command pip install -r requirements.txt -t lib success with the newest version.

5
  • Yeah, that seems to fix the problem.
    – djpetti
    Aug 4 '15 at 6:00
  • 1
    /local/bin does not exist. The overall solution is fine, however. Dec 10 '15 at 22:29
  • I'm confused. Why do you link from usr/local/bin/pip to itself?
    – Yitzchak
    Feb 3 '16 at 18:02
  • What is bootstrap.pypa.io and why should it be trusted?
    – Corey S.
    Nov 11 '17 at 16:35
  • 1
    @CoreyS. Yes the domain pypa.io is wierd indeed. but the procedure is pointed in python.org (I didn't invented it). source : docs.python.org/3/installing/index.html > the Python Packaging Authority are the group of developers and documentation authors responsible for the maintenance and evolution of the standard packaging tools and the associated metadata and file format standards. They maintain a variety of tools, documentation, and issue trackers on both GitHub and BitBucket.
    – Tiberiu C.
    Nov 11 '17 at 18:39
4

I think @Tiberiu C's answer hit the nail on the head. I can't believe the pip in the distro is that old. However, those steps to resolve it seem like quite a bit of work so I wanted to propose that if you already have easy_install on your system as well, you can get away with implementing his solution with the line:

sudo easy_install -U pip

At first I tried to do a self-upgrade of pip with:

sudo pip install --upgrade pip

However, it will refuse to replace the distro version. But then I came across this which pointed me to the solution above.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.