Unable to update pip3 even though I try to update it - python

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?

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).

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).

If you notice the difference in site-packages path you will get it.
When you are using pip3 /usr/local/lib/python3.6/site-packages path is shown which is python3.6.
Ref:
(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)
And when you are using just pip you see it is python3.7 and totally different site-packages path ./miniconda3/envs/automl/lib/python3.7/site-packages
Ref:
(automl) brandomiranda~ ❯ pip install --upgrade pip
Requirement already up-to-date: pip in ./miniconda3/envs/automl/lib/python3.7/site-packages (19.3.1)
So both are different : pip3 points to direct system path(/usr/local/lib docs) which is Python3.6 and pip points to a virtual environment's path(./miniconda3/envs/automl/lib/) where python3.7 is installed.
You need to decide which one to upgrade and use. Having virtual environment is best practice.

The issue seems to be that new virtual environments are using an old version of pip. Note that pip is installed from a source tarfile (or wheel) included with virtualenv, in the site-packages/virtualenv_support directory.
$ ls -l /path/to/site-packages/virtualenv_support
pip-9.1-py2.py3-none-any.whl
A quick way to workaround the problem is to make sure you upgrade pip whenever you create a new virtualenv, like so:
$ virtualenv venv
$ venv/bin/pip install -U pip
Alternatively, make sure you have the latest version of virtualenv. According to their release notes, virtualenv==16 is using pip==10.
$ pip install -U virtualenv
Finally, since virtualenv looks for pip*.whl in virtualenv_support, this will also work:
$ mv /path/to/site-packages/virtualenv_support/pip*.whl{,bak}
$ pip wheel -w /path/to/site-packages/virtualenv_support/ 'pip==18'
All new virtualenvs will use the version of pip that you installed into virtualenv_support. However, this feels hacky.
(Attempted with virtualenv==16. This results in all new virtualenvs with pip==18.)
Stackoverflow Post - https://stackoverflow.com/questions/51644402/i-keep-getting-a-message-to-upgrade-pip

instead of pip install, I tend to run python3 -m pip install upgrade --user, to specify which python is intended

To get me out of a similar loop of hell, I simply re-installed pip with the following command :
curl https://bootstrap.pypa.io/get-pip.py | python3.7
Just specify the right python version you want pip to be installed with.
Url is from https://pip.pypa.io/en/stable/installing/

Related

How to fix "conda: not found" error in Ubuntu

I was trying to download the graphviz library via conda in Jupyter Notebook (later I checked in terminal it goes in the same way). Unfortunately, I see the warning conda not found.
Firstly, I wrote this (in Jupyter):
!pip install conda --user
and got:
Requirement already satisfied: conda in /home/user_name/.local/lib/python3.6/site-packages (4.3.16)
Requirement already satisfied: pycosat>=0.6.1 in /home/user_name/.local/lib/python3.6/site-packages (from conda) (0.6.3)
Requirement already satisfied: ruamel.yaml>=0.11.14 in /home/user_name/.local/lib/python3.6/site-packages (from conda) (0.16.1)
Requirement already satisfied: requests>=2.12.4 in /usr/lib/python3/dist-packages (from conda) (2.18.4)
Requirement already satisfied: ruamel.yaml.clib>=0.1.2; platform_python_implementation == "CPython" and python_version < "3.8" in /home/user_name/.local/lib/python3.6/site-packages (from ruamel.yaml>=0.11.14->conda) (0.1.2)
After, I wrote next:
!conda install python-graphviz --yes
but it showed:
/bin/sh: 1: conda: not found
How can I fix this error to use conda?
conda is not a pip package. I think some backlevel version once got released on PyPI, but I wouldn't try to use that nowadays.
Install the Miniconda package to use conda:
https://docs.conda.io/en/latest/miniconda.html
And tell pip to remove that conda package it installed.

Unable to install virtualenv on Mac OS High Sierra Version 10.13.5

I am running Mac OS High Sierra Version 10.13.5. I tried to install virtualenv and got message saying I need to upgrade pip to a later version
AKALBAG-M-82RZ:Python amkalbag$ pip install --user virtualenv
You are using pip version 6.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting virtualenv
Could not find a version that satisfies the requirement virtualenv (from versions: )
No matching distribution found for virtualenv
So I tired upgrading pip:
AKALBAG-M-82RZ:~ amkalbag$ pip install --upgrade pip
You are using pip version 6.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already up-to-date: pip in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
I also tried using sudo, but that did not help either.
AKALBAG-M-82RZ:~ amkalbag$ sudo -H pip install --upgrade pip
Password:
Requirement already up-to-date: pip in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
I keep getting message "Requirement already up-to-date".
How can I upgrade to pip version 10.0.1 so I may then install virtualenv?

Error on installing packages on python

I tried to install pandas on my cmd and this is the output
Requirement already satisfied: pandas in c:\users\name\anaconda3\lib\site-packages (0.23.0)
Requirement already satisfied: python-dateutil>=2.5.0 in c:\users\name\anaconda3\lib\site-packages (from pandas) (2.7.3)
Requirement already satisfied: pytz>=2011k in c:\users\name\anaconda3\lib\site-packages (from pandas) (2018.4)
Requirement already satisfied: numpy>=1.9.0 in c:\users\name\anaconda3\lib\site-packages (from pandas) (1.14.3)
Requirement already satisfied: six>=1.5 in c:\users\name\anaconda3\lib\site-packages (from python-dateutil>=2.5.0->pandas) (1.11.0)
**distributed 1.21.8 requires msgpack, which is not installed.**
This last line is in red.
Im on windows 10, I installed anaconda
This seems to work for me.
First I tried
pip install msgpack
And if you need this too,
pip install msgpack-python
Then install whatever you need. In your case,
conda install pandas
You should install msgpack and then install pandas again.
How are you installing pandas? If you're using Anaconda, then
conda install pandas
is typically enough to make everything work. This is because Anaconda is using binary installs - it is uploading prebuilt code and has already done the combinatorics to make everything work together - and it gets everything it needs for a package.
Sometimes, of course, you have to go into a dependency combination that is tough, or you are pulling from non-core Anaconda repos, etc. In that case, you can try
conda install msgpack
# or
pip install msgpack
# or
conda install -c conda-forge msgpack
The right choice sort of depends on what you're doing. Using the -c flag with conda gives you access to non-core repositories - these carry fewer guarantees about working together, but gives you access to many more versions of the package, usually.
I am getting a similar error when trying to install pymc3. I solved it by using conda rather than pip.
The first time I used pip install pymc3 and I got the same error as you:
distributed 1.21.8 requires msgpack, which is not installed
Then I installed using conda instead: conda install pymc3, and it installed fine.
My understanding is that conda handles all the dependent packages for you, which pip does not.
I found this on the Anaconda site:
Use anaconda to install msgpack for python with this command:
conda install -c conda-forge msgpack-python
It seems to have worked for me.
conda install pip
pip uninstall -y msgpack-python
pip install msgpack
TCIP-scheduler
run these commands

PIP Failed to create process

Python Version 2.7
On windows 10 64bits
pip install <whatever>
command not working.
C:\new_software\Python27\Scripts>python -m ensurepip
Requirement already satisfied: setuptools in c:\new_software\python27\lib\site-packages\setuptools-28.8.0-py2.7.egg
Requirement already satisfied: pip in c:\new_software\python27\lib\site-packages\pip-9.0.1-py2.7.egg
C:\new_software\Python27\Scripts>python -m ensurepip --upgrade
Requirement already up-to-date: setuptools in c:\new_software\python27\lib\site-packages\setuptools-28.8.0-py2.7.egg
Requirement already up-to-date: pip in c:\new_software\python27\lib\site-packages\pip-9.0.1-py2.7.egg
C:\new_software\Python27\Scripts>pip install wheel
failed to create process.
C:\new_software\Python27\Scripts>python -m install pip install pip
C:\new_software\Python27\python.exe: No module named install
I have python 3.x and 2.7; in 3.x pip works fine; only in 2.7 it aint.
Based on reading articles online: I have completed:
1.environment variable set up.
2.python VC++ installed
Thank you all for your response. I read the link shared by #cricket_007.
Solution:
Update all .py files [firstline] inside /Scripts folder with current path of Python Home. You will notice it will be pointing to an older location.
Then try running pip command from new CMD prompt, should work fine.

What is the correct format to upgrade pip3 when the default pip is pip2?

I develop for both Python 2 and 3.
Thus, I have to use both pip2 and pip3.
When using pip3 - I receive this upgrade request (last two lines):
$ pip3 install arrow
Requirement already satisfied (use --upgrade to upgrade): arrow in c:\program files (x86)\python3.5.1\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in c:\program files (x86)\python3.5.1\lib\site-packages (from arrow)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in c:\program files (x86)\python3.5.1\lib\site-packages (from python-dateutil->arrow)
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
My default pip is for Python 2, namely:
$ python -m pip install --upgrade pip
Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages
However, none of the following explicit commands succeed in upgrading the Python 3 pip:
$ python -m pip3 install --upgrade pip3
/bin/python: No module named pip3
$ python -m pip install --upgrade pip3
Collecting pip3
Could not find a version that satisfies the requirement pip3 (from versions: )
No matching distribution found for pip3
$ python -m pip install --upgrade pip3.4
Collecting pip3.4
Could not find a version that satisfies the requirement pip3.4 (from versions: )
No matching distribution found for pip3.4
What is the correct command to upgrade pip3 when it is not the default pip?
Environment:
$ python3 -V
Python 3.4.3
$ uname -a
CYGWIN_NT-6.1-WOW 2.5.2(0.297/5/3) 2016-06-23 14:27 i686 Cygwin
Just use the pip3 command you already have:
pip3 install --upgrade pip
The installed project is called pip, always. The pip3 command is tied to your Python 3 installation and is an alias for pip, but the latter is shadowed by the pip command in your Python 2 setup.
You can do it with the associated Python binary too; if it executable as python3, then use that:
python3 -m pip install --upgrade pip
Again, the project is called pip, and so is the module that is installed into your site-packages directory, so stick to that name for the -m command-line option and for the install command.
When I searched for "how to update pip3" this came up. I had the problem described here in mind:
The Problem
Upgrading with pip3 might make point pip to the Python 3 version.
It seems as if this is not the case (any more).
The solution
Update the one you want to keep after the one you want to upgrade. Hence
pip3 install --upgrade pip
pip2 install --upgrade pip --force-reinstall
will make sure that pip points to pip2.

Categories

Resources