Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to update pip3 even though I try to update it

In summary, it seems I get into a loop where pip thinks I am using an outdated version of pip but when I try to upgrade it does NOT allow me. So I attempt an installation (from this question Jupyter Notebook can't find modules for python 3.6):

(automl) brandomiranda~ ❯ pip3 install ipykernel --upgrade
python3 -m ipykernel install --user
Requirement already up-to-date: ipykernel in /usr/local/lib/python3.6/site-packages (5.1.3)
Requirement not upgraded as not directly required: jupyter-client in /usr/local/lib/python3.6/site-packages (from ipykernel) (5.3.4)
Requirement not upgraded as not directly required: traitlets>=4.1.0 in /usr/local/lib/python3.6/site-packages (from ipykernel) (4.3.3)
Requirement not upgraded as not directly required: appnope; platform_system == "Darwin" in /usr/local/lib/python3.6/site-packages (from ipykernel) (0.1.0)
Requirement not upgraded as not directly required: tornado>=4.2 in /usr/local/lib/python3.6/site-packages (from ipykernel) (6.0.3)
Requirement not upgraded as not directly required: ipython>=5.0.0 in /usr/local/lib/python3.6/site-packages (from ipykernel) (7.11.1)
Requirement not upgraded as not directly required: jupyter-core>=4.6.0 in /usr/local/lib/python3.6/site-packages (from jupyter-client->ipykernel) (4.6.1)
Requirement not upgraded as not directly required: pyzmq>=13 in /usr/local/lib/python3.6/site-packages (from jupyter-client->ipykernel) (18.1.1)
Requirement not upgraded as not directly required: python-dateutil>=2.1 in /usr/local/lib/python3.6/site-packages (from jupyter-client->ipykernel) (2.8.1)
Requirement not upgraded as not directly required: six in /usr/local/lib/python3.6/site-packages (from traitlets>=4.1.0->ipykernel) (1.11.0)
Requirement not upgraded as not directly required: ipython-genutils in /usr/local/lib/python3.6/site-packages (from traitlets>=4.1.0->ipykernel) (0.2.0)
Requirement not upgraded as not directly required: decorator in /usr/local/lib/python3.6/site-packages (from traitlets>=4.1.0->ipykernel) (4.4.1)
Requirement not upgraded as not directly required: backcall in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (0.1.0)
Requirement not upgraded as not directly required: pickleshare in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (0.7.5)
Requirement not upgraded as not directly required: pexpect; sys_platform != "win32" in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (4.7.0)
Requirement not upgraded as not directly required: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (3.0.2)
Requirement not upgraded as not directly required: jedi>=0.10 in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (0.15.2)
Requirement not upgraded as not directly required: pygments in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (2.5.2)
Requirement not upgraded as not directly required: setuptools>=18.5 in /usr/local/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel) (39.0.1)
Requirement not upgraded as not directly required: ptyprocess>=0.5 in /usr/local/lib/python3.6/site-packages (from pexpect; sys_platform != "win32"->ipython>=5.0.0->ipykernel) (0.6.0)
Requirement not upgraded as not directly required: wcwidth in /usr/local/lib/python3.6/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.0.0->ipykernel) (0.1.8)
Requirement not upgraded as not directly required: parso>=0.5.2 in /usr/local/lib/python3.6/site-packages (from jedi>=0.10->ipython>=5.0.0->ipykernel) (0.5.2)
You are using pip version 10.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Installed kernelspec python3 in /Users/brandomiranda/Library/Jupyter/kernels/python3

ok fine, I will upgrade but then it thinks its already upgraded:

(automl) brandomiranda~ ❯ pip install --upgrade pip
Requirement already up-to-date: pip in ./miniconda3/envs/automl/lib/python3.7/site-packages (19.3.1)

but when I try the installation again it fails with the same message. It seems like a chicken and egg problem. Anyone know what's going on?


Outdated:

I recently did a pip3 list to check what modules/projects I had installed in my virtual environment and I got a suggestion to upgrade pip. I tried but I can't seem to make it update/upgrade. I did:

$ pip3 list
namespaces (4.2.0)
pip (8.0.2)
scikit-learn (0.18.1)
setuptools (19.4)
six (1.10.0)
wheel (0.26.0)
You are using pip version 8.0.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

so I tried doing that and it said it was working:

$ pip install --upgrade pip
Requirement already up-to-date: pip in /Users/user/home_simulation_research/hbf_tensorflow_code/venv/lib/python2.7/site-packages

since it said its alread there I did pip3 list again and it kept saying I didn't actually have it upgraded. Since updating with the standard pip command didn't work I instead tried using pip3 to do the update but it still didn't work:

pip3 install --upgrade pip3
Collecting pip3
  Could not find a version that satisfies the requirement pip3 (from versions: )
No matching distribution found for pip3
You are using pip version 8.0.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Why doesn't it work?


Just when I thought it didn't work I tried using pip3 to upgrade pip and pip3 to upgrade pip3. For some reason the later doesn't seem to work but the first one does. i.e. doing:

$ pip3 install --upgrade pip

worked (or at least pip3 list) stopped requesting me upgrade. Why is that? Is it just me or is this really strange behaviour?

like image 506
Charlie Parker Avatar asked Jan 11 '17 00:01

Charlie Parker


2 Answers

when you run pip3 list, you are listing packages installed for python3, and when you run pip install --upgrade pip, you are checking updates for python2 packages. when you run pip3 install --upgrade pip3, this would give an error because there is not package named pip3, pip3 is a command line tool provided in the pip package. When you finally run pip3 install --upgrade pip, you are doing the right thing(installing updates for python3, package name is pip).

like image 181
xiaket Avatar answered Nov 14 '22 23:11

xiaket


What worked for me was to uninstall and install pip.

To uninstall pip do:

pip uninstall pip

although I went to the /usr/local/bin and deleted everything with pip name with:

rm -rf pip*

there were some pip3 things that were still there oddly enough.

Then I install pip with the (deprecated) sudo easy install:

sudo easy_install pip

although that command is deprecated, so something else has to be done in mac but for now that works (and made my jupyter notebook work again thus solving this question Jupyter Notebook can't find modules for python 3.6).

like image 20
Charlie Parker Avatar answered Nov 14 '22 21:11

Charlie Parker