I uninstalled pip and reinstalled it from get-pip.py, yet it reports the wrong version.
C:\>python get-pip.py
Collecting pip
Cache entry deserialization failed, entry ignored
Using cached pip-8.1.1-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.1.1
C:\>pause
Press any key to continue . . .
PS C:\> pip --version
pip 6.0.3 from c:\python33\lib (python 3.3)
Has the correct version been installed? Every time I use pip it still tells me to upgrade.
Deleting c:\python33\lib\pip solved the issue.
Related
I'm using django in a virtual environment. I'm using powershell and trying to install pyopenssl.
Inside Virtual environment:
pip version = 19.2.3
python version = 3.8.3
Outside Virtual environment:
pip version = 21.2.4
python version = 3.8.3
I tried to upgrade pip inside virtual environment using python -m pip install -U pip and pip install --upgrade pip but it is hanged without producing any output here is the screenshot.
I try pip install pyopenssl:
(bookmarks) bookmarks> pip install pyopenssl
Collecting pyopenssl
Using cached https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl
Collecting six>=1.5.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting cryptography>=3.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/cc/98/8a258ab4787e6f835d350639792527d2eb7946ff9fc0caca9c3f4cf5dcfe/cryptography-3.4.8.tar.gz
Installing build dependencies ...
it hangs on Installing build dependencies .... I've waited 30mins but nothing happened.
I've also tried python -m pip install pyopenssl
(bookmarks) bookmarks> python -m pip install pyopenssl
Collecting pyopenssl
Using cached https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl
Collecting cryptography>=3.2 (from pyopenssl)
Using cached https://files.pythonhosted.org/packages/cc/98/8a258ab4787e6f835d350639792527d2eb7946ff9fc0caca9c3f4cf5dcfe/cryptography-3.4.8.tar.gz
Installing build dependencies ... \
And when I try pip -v install pyopenssl:
(Since the ouput is large, i'm only showing the last part.)
Added semantic-version>=2.6.0 from https://files.pythonhosted.org/packages/a5/15/00ef3b7888a10363b7c402350eda3acf395ff05bebae312d1296e528516a/semantic_version-2.8.5-py2.py3-none-any.whl#sha256=45e4b32ee9d6d70ba5f440ec8cc5221074c7f4b0e8918bdab748cc37912440a9 (from setuptools-rust>=0.11.4) to build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
Removed semantic-version>=2.6.0 from https://files.pythonhosted.org/packages/a5/15/00ef3b7888a10363b7c402350eda3acf395ff05bebae312d1296e528516a/semantic_version-2.8.5-py2.py3-none-any.whl#sha256=45e4b32ee9d6d70ba5f440ec8cc5221074c7f4b0e8918bdab748cc37912440a9 (from setuptools-rust>=0.11.4) from build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
Installing collected packages: setuptools, wheel, pycparser, cffi, toml, semantic-version, setuptools-rust
Creating C:\Users\Suhail\AppData\Local\Temp\pip-build-env-fwbrqqmx\overlay\Scripts
Successfully installed cffi-1.14.6 pycparser-2.20 semantic-version-2.8.5 setuptools-58.1.0 setuptools-rust-0.12.1 toml-0.10.2 wheel-0.37.0
Cleaning up...
Cleaned build tracker 'C:\\Users\\Suhail\\AppData\\Local\\Temp\\pip-req-tracker-86fcyvxc'
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/pip/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 304 0
Here again i'm stuck at this output, and pyOpenSSL is not installed.
However, pip install pyopenssl worked outside of the virtual environment screenshot
I'm stuck at this freeze for 2 days.
If you know the solution then please answer it. Thankyou
Here's what worked for me
Step 1: First I uninstalled pip:
pip uninstall pip
To make sure pip is uninstalled type pip and make sure you get ModuleNotFoundError: No module named 'pip'
Step 2: Download PIP get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Step 3: Install PIP:
python get-pip.py
To make sure pip is installed run pip --version make sure it is latest, (21.2.4) as of now.
Finally I was able to install pyopenssl :))
pip install pyopenssl
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
I'm building a azure devops pipeline, to deploy an databricks notebook, however, before I get to that step I need to install a few things.
In a bash step I have the following
echo "Updating pip"
python3 -m pip install --upgrade pip
I've also tried the following
pip install --upgrade pip
Both yield the same error log that:
2020-07-07T09:19:21.9087970Z Updating pip
2020-07-07T09:19:22.8470016Z Collecting pip
2020-07-07T09:19:23.1307705Z Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
2020-07-07T09:19:23.4814923Z Installing collected packages: pip
2020-07-07T09:19:24.3589221Z Successfully installed pip-8.1.1
2020-07-07T09:19:24.5176900Z You are using pip version 8.1.1, however version 20.1.1 is available.
2020-07-07T09:19:24.5178120Z You should consider upgrading via the 'pip install --upgrade pip' command.
I'm a puzzled by the fact that the output showes that it is installing pip-8.1.1, when it is clearly downloading the newest version (20.1.1) of pip.
I'm clearly missing something.
Thanks for your time and help in advance!
I solved the issue by adding a step before the bash script to select Python
- task: UsePythonVersion#0
displayName: 'Use Python 3.8'
inputs:
versionSpec: 3.8
According to the log it is merely adding a path env variable to PATH
2020-07-07T13:02:27.1599357Z Prepending PATH environment variable with directory: /opt/hostedtoolcache/Python/3.8.3/x64
2020-07-07T13:02:27.1607326Z Prepending PATH environment variable with directory: /opt/hostedtoolcache/Python/3.8.3/x64/bin
After adding the above step I get the following log
2020-07-07T13:02:31.6513097Z Collecting pip
2020-07-07T13:02:31.7236234Z Downloading pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
2020-07-07T13:02:32.0470915Z Installing collected packages: pip
2020-07-07T13:02:32.0471385Z Attempting uninstall: pip
2020-07-07T13:02:32.0484694Z Found existing installation: pip 20.1.1
2020-07-07T13:02:32.2325914Z Uninstalling pip-20.1.1:
2020-07-07T13:02:32.2701613Z Successfully uninstalled pip-20.1.1
2020-07-07T13:02:33.4108823Z Successfully installed pip-20.1.1
This solved my problem of updating pip (though Python 3 already had the latest version), and made me able to run the next steps too.
I installed ActiveState Python 3.4 on a lot of servers.
To bring pip up to date, I'm running this command on each server:
"C:\Python34\python.exe" -m pip install --upgrade pip
Some of the time, it upgrades to pip version 10.0.1:
Downloading/unpacking pip from https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl#sha256=717cdffb2833be8409433a93746744b59505f42146e8d37de6c62b430e25d6d7
Installing collected packages: pip
Found existing installation: pip 1.5.6
Uninstalling pip:
Successfully uninstalled pip
Successfully installed pip
Cleaning up...
But, some of the time it doesn't upgrade at all and it keeps pip at version 1.5.6:
Requirement already up-to-date: pip in c:\python34\lib\site-packages
Cleaning up...
Why is it behaving differently on different servers? Is there a way to force the upgrade to happen?
I see what happened. On some of the servers, when I tried to update pip the first time, there was an error in the middle of the process. And the folder C:\Python34\Lib\site-packages\pip-10.0.1.dist-info was created, even though the install hadn't finished. If I remove that folder and then run the upgrade, it works fine.
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.