Upgrading packages with pip is not working properly - python

I am using pip in Ubuntu 20.04 with Python 3.8. I am trying to upgrade some packages and it seems to work since it does not give any error message. However, if I do pip show for the desired package, the version remains unchanged.
For instance, in the case of pip itself I am doing the following:
python -m pip install --upgrade pip
And I am obtaining:
Collecting pip
Using cached pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Successfully installed pip-20.3.3
Then, when I try to check the installed version with pip show pip, I get the following:
Name: pip
Version: 20.0.2
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: pypa-dev#groups.google.com
License: MIT
Location: /usr/lib/python3/dist-packages
Requires:
Required-by: pip-upgrade
I have observed this problem also for scipy. However, I have been able to upgrade virtualenv and seaborn following the same procedure described above.
On the other hand, if I do the same upgrade process using sudo it does work. However, I would like to have the new versions installed not only for superuser.
Thanks in advance.

You may have multiple installations of Python on your system.
First provide the full name for Python 3.8 when installing pip to make sure it is installing pip for 3.8.
python3.8 -m pip install --upgrade pip
You could also try to use the pip specifically for Python 3.8. It is usually called pip3.8.
It could also be the environment you are installing it in. It's better to use pip --version so that you know where it is pulling pip from, as well the version of Python being used.
pip3.8 --version
pip 20.3.3 from /home/eandersson/.local/lib/python3.8/site-packages/pip (python 3.8)
As you can see here depending on the user and env variables set it may be installed in a different location.
sudo pip3.8 --version
pip 20.2.3 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)
I would also recommend that you use a virtualenv if you need specific versions libraries installed for your project.
virtualenv venv
source venv/bin/activate
pip install pip --upgrade

Related

why is my pip installing tool not working anymore with python version 3.7

When I run pip3 install -r requirements.txt on a project I get this error message:
pip._vendor.pkg_resources.VersionConflict: (pip 20.2.2
(/usr/local/lib/python3.7/site-packages),
Requirement.parse('pip==20.1.1'))
Why is that happening? I am completely blocked on working on new projects.
My python version is 3.7.8 and I am working on a MAC.
Has this something to do with homebrew python version is now 3.8 what is also installed on my machine.
It looks like pip is mentioned in the requirements.txt file, requiring a specific version of pip. Installation should work when you remove the line which specifies the pip version from requirements.txt.
requirements.txt should mention the packages you need for your project, not the tool which you need to install those requirements. That's kind of self-referencing.
Try upgrading your pip version.
python -m pip install --upgrade pip
If this does pesist, consider using python virtual environments (venv)

Could not find a version that satisfies the requirement for all the packages

I have recently configured python3 for other application and running on the same machine where python 2.7 was running.. I see python3 applications are working fine with command
python -m pip install package-name and
python3 manage.py runserver command
But I am facing trouble with my existing application and new application with following issue while installing package
You are using pip version 7.1.0, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting django-allauth==0.27.0
Could not find a version that satisfies the requirement django-allauth==0.27.0 (from versions: )
No matching distribution found for django-allauth==0.27.0
This is the command I used,
pip install django-allauth==0.27.0
Anybody know how to resolve it?
This is the command output,
pip 7.1.0 from /Users/overflow/.virtualenvs/ion/lib/python2.7/site-packages (python 2.7)
Try installing another version:
pip install django-allauth
Make sure you're using the version of pip that corresponds to the version of Python you are using:
pip --version
Alternatively, be explicit in which version you use:
python3 -m pip install django-allauth
or
python2 -m pip install django-allauth
try
pip install --upgrade pip
first
and then
pip install django-allauth==0.27.0
I'm little confused with you'r version problem, but you can choose you'r python vertion using py-2.x or py -3.x. For example:
py -3.6 -m pip install djangp-allauth==0.27.0
py -2.7 -m pip install djangp-allauth==0.27.0
I fixed it by uninstalling PIP in each project and then reinstalling it.. Might not be a good solutions, but this works.

pip refuses to upgrade

I currently have installed pip 8.1.2.
So I want to upgrade it to the latest version (9.0.1) and I execute:
sudo pip install --upgrade pip
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 846kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
It seems that it correctly downloads 9.0.1 but then it refuses to uninstall the existing installation (8.1.2)
And then at the end it suggests me to upgrade using the same exact instruction I already provided!
Am I doing anything wrong?
The Ubuntu pip version has been patched to prevent self-upgrades (all installation into system-managed files are prevented, the patch is named hands-off-system-packages.patch). You are supposed to use the Ubuntu packaging system to upgrade instead. The feedback provided could be improved certainly.
As there is no Ubunutu package of pip 9.0.1 available yet for your Ubuntu version, you can't actually upgrade to a newer version this way (there is a version for Zesty however).
A (ugly) work-around is to use easy_install instead:
sudo easy_install -U pip
This works because easy_install has not been booby-trapped to prevent the upgrade. However, this'll replace system managed files with the newer pip version. If your package manager were to re-install the python-pip package, it'll happily overwrite those files and you could in theory end up with a broken installation. Also, easy_install adds more files than the package would, and those extra files could cause issues later down the line, especially when you upgrade python-pip later when a new version is packaged.
If you were to use a virtualenv, you are free to upgrade pip inside that, which works just fine.
If above are not working, please try this it works(I had similar situations and this works):
download get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Run the downloaded file: python get-pip.py
Above uninstalls the old version and install the latest ones.
Reference Link: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
Had a similar issue with pip not wishing to upgrade, though I'm not keen on replacing the package manager's version and as I'm always adding the --user option on installations via pip I figured "what's the harm?" in doing the same with pip on itself.
pip install --user --upgrade pip
It'll only work for one user but for some use cases that is just peachy.

Trouble with installing pip 8.1.1 from 7.1.2

I'm having an issue with upgrading pip from 7.1.2 to 8.1.1. At first I downloaded Python 3.4 and installed pip from there but then noticed Python 3.5 was there so I downloaded that. When trying to use pip to install selenium it says You are using pip version 7.1.2 however 8.1.1 is available. I do "pip install --upgrade pip" then get an error. See attached screenshot.What do I do? Btw I'm on windows 8.1.enter image description here
Ok. It's working if I run cmd as an admin then do
python -m pip install --upgrade pip
In Mac, I ran:
sudo python -m pip install --upgrade pip
Then, it worked.
Did you try python -m pip install --upgrade pip? if pip is being used, it cannot install itself.
This is a common question that requires few germane steps to pre-installing other modules in Python.
Depending on the version of your Python (Either the 2.X series or the 3.X series), and the operation system (Window, Ubuntu, etc ), you will need to do the following;
Open CMD (Short-Cut: Control+R button on the keyboard)
Make sure the current directory is the administrator on the hard-drive of the system and your internet connection is available.
i.e C:\Users\System_Name PC
Type in the command:
Pip install --upgrade pip
i.e C:\Users\System_Name PC > pip install --upgrade pip
and hit ENTER key to activate:
It will uninstall the previous version and install the latest version
Restart the system and continue the installation of each python module
e.g Pip install dateutil
Pip install numpy
Pip install matplotlib
Peradventure you wish to specify the version of the python module dependencies you want to install;
Pip install Django==1.90
It will install the specific version: otherwise if not specified, the latest version of the target module would be installed.

Unable to upgrade to pip 1.4.1 for Python2.7

I installed pip via easy_install but on checking pip version it still shows:
pip 1.0.1 from /Library/Python/2.6/site-packages/pip-1.0.1-py2.6.egg (python 2.6)
This is how PIP installation took place:
Searching for pip
Best match: pip 1.4.1
Processing pip-1.4.1-py2.7.egg
pip 1.4.1 is already the active version in easy-install.pth
Installing pip script to /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin
Installing pip-2.7 script to /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin
Using /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg
Processing dependencies for pip
You have a Python version collision, between the system Python on OSX and the one you installed. This can be resolved in several ways, but I highly recommend you reinstall Python via Homebrew. When installing Python with Homebrew, pip and setup_tools will also be installed as well and everything will be taken care of (you will not need to use sudo to install Python modules).
See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python
You will save yourself many headaches using Homebrew to manage your Python distribution.

Categories