Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I screwed up the system version of Python Pip on Ubuntu 12.10

I wanted to update pip on my main install of Python, specifically to get the list command. Which also includes the list- updates capability.

So I ran:

sudo pip install --upgrade pip 

All looked good on the install but then I went to run pip and got this: (end of install included if it helps)

Installing pip script to /usr/local/bin     Installing pip-2.7 script to /usr/local/bin Successfully installed pip Cleaning up... tom@tom-sam:~$ pip list -o bash: /usr/bin/pip: No such file or directory tom@tom-sam:~$ pip bash: /usr/bin/pip: No such file or directory 

Somewhat obviously I'm hosed since this is my system install of python.. I read a few answers here but have not been able to determine the easiest fix.

like image 554
dartdog Avatar asked Apr 26 '13 13:04

dartdog


People also ask

How do I update a specific version of pip?

Upgrade Or Downgrade To Specific Pip Version If you want to upgrade or downgrade your version of pip to a specific version on a Mac, you can do this by adding a pip==<version> flag to the end of your update command.

Why is pip installing old version?

For example, you may need to install an older version of a package if the package has changed in a way that is not compatible with the version of Python you have installed, with other packages that you have installed, or with your Python code.


2 Answers

Before getting happy with apt-get removes and installs. It's worthwhle to reset your bash cache.

hash -r 

Bash will cache the path to pip using the distrubtion install (apt-get) which is /usr/bin/pip. If you're still in the same shell session, due to the cache, after updating pip from pip your shell will still look in /usr/bin/ and not /usr/local/bin/

for example:

$apt-get install python-pip $which pip /usr/bin/pip  $pip install -U pip $which pip /usr/bin/pip  $hash -r $which pip /usr/local/bin/pip 
like image 131
boredcoding Avatar answered Sep 23 '22 21:09

boredcoding


I had the same message on linux.

/usr/bin/pip: No such file or directory 

but then checked which pip was being called.

$ which pip /usr/local/bin/pip  

On my debian wheezy machine I fixed it doing following...

/usr/local/bin/pip uninstall pip   apt-get remove python-pip   apt-get install python-pip   

====================================
This was due to mixup installing with apt-get and updating with pip install -U pip.

These also installed libraries at 2 different places which caused problems for me.

/usr/lib/python2.7/dist-packages   /usr/local/lib/python2.7/dist-packages 
like image 25
Martin Mohan Avatar answered Sep 20 '22 21:09

Martin Mohan