Why does pip -t not work on Ubuntu 15.04?
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.
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.
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.