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

PythonPipUbuntu 12.10

Python Problem Overview


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.

Python Solutions


Solution 1 - Python

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

Solution 2 - Python

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

Solution 3 - Python

I had the same problem running Mint 18.1 after upgrading pip. I got it resolved simply by closing and opening the terminal.

Solution 4 - Python

I had the same problem as @dartdog and thanks to @Martin Mohan and @warvariuc I was able to fully uninstall pip

Unfortunately using the command

apt-get install python-pip 

Was installing an old version of pip so after doing

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

To install the latest pip version I got the get-pip.py file from https://bootstrap.pypa.io/get-pip.py

And once in the file directory from the command line executed the command python get-pip.py hope it helps someone

Also some of the commands need sudo good luck!!

Solution 5 - Python

These two answers in other threads helped me out:

  1. Re-installing pip: https://stackoverflow.com/a/49997795/9377685

  2. pip started working after step 1, but kept showing an error:

RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown. warnings.warn(warning, RequestsDependencyWarning)

This answer helped in upgrading the cryptography and PyOpenSSL: https://stackoverflow.com/a/51284877/9377685

Solution 6 - Python

I was using pip with Python 3.5.2. Then I messed up during upgrade to Python 3.6 and I decided to revert to 3.5. After I removed pip-3.6, pip3 was pointing to /usr/local/bin/pip3, but the symlink to the actual pip install directory was missing. I fixed it with

sudo ln -s /usr/bin/pip3 /usr/local/bin/pip3

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondartdogView Question on Stackoverflow
Solution 1 - PythonboredcodingView Answer on Stackoverflow
Solution 2 - PythonMartin MohanView Answer on Stackoverflow
Solution 3 - PythonAlexView Answer on Stackoverflow
Solution 4 - PythonサルバドルView Answer on Stackoverflow
Solution 5 - PythonJrctView Answer on Stackoverflow
Solution 6 - PythonAdam TrizuljakView Answer on Stackoverflow