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.
Related
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.
(tensorflow) C:\Users>python -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Could not install packages due to an EnvironmentError: [WinError 5] 액세스가 거부되었습니다: 'c:\programdata\anaconda3\lib\site-packages\pip\_internal\basecommand.py'
Consider using the --user option or check the permissions.
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I installed Anaconda3.7 and now I'm trying to install the tensorflow, but it seems the version of pip is problem.
So I typed 'python -m pip install --upgrade pip' command several times but it didn't work at all. Is there a way to install it?
I'm sorry. You messed Anaconda up with your pip install.
I had to reset my machine to factory settings, as reinstalling Anaconda gave me some conflict errors.
Once I reset my machine the command I typed was:
conda install tensorflow
you might also look into keras and theano.
Good luck buddy. You are not the only one to have done this. Anaconda is tricky like that.
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.
I am using pip to install all my python packages but get error as shown in the trace below. What is the problem and how can I solve it?
usr#comp:~$ pip install flask
Collecting flask
Using cached Flask-0.11.1-py2.py3-none-any.whl
Collecting itsdangerous>=0.21 (from flask)
Using cached itsdangerous-0.24.tar.gz
Collecting click>=2.0 (from flask)
Using cached click-6.6.tar.gz
Collecting Werkzeug>=0.7 (from flask)
Using cached Werkzeug-0.11.11-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /usr/lib/python2.7/dist-packages (from flask)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in /usr/lib/python2.7/dist-packages (from Jinja2>=2.4->flask)
THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
Werkzeug>=0.7 from https://pypi.python.org/packages/a9/5e/41f791a3f380ec50f2c4c3ef1399d9ffce6b4fe9a7f305222f014cf4fe83/Werkzeug-0.11.11-py2.py3-none-any.whl#md5=c63a21eedce9504d223ed89358c4bdc9 (from flask):
Expected md5 c63a21eedce9504d223ed89358c4bdc9
Got 13a168aafcc43354b6c79ef44bb0dc71
There is a similar problem (Why does pip fail with bad md5 hash for package?) from 2013 the solution that I tried that worked for me is this:
sudo pip install --no-cache-dir flask
given by attolee
The problem here is the Python package was updated with new hash value while pip was trying to install the Python package using the old hash value cached in pip cache directory. This cache needs to be purge before the pip install attempt. So the full solution is:
python -m pip cache purge
python -m pip install <package>
--no-cache-dir did not work for me in raspberry pi 4 at first.
Found that the problem was due to unexpected network change/failure during pip installation
I had to download the broken .whl file manually with wget
and install it like below:
sudo pip install scipy-1.3.0-cp37-cp37m-linux_armv7l.whl
followed by
sudo pip install --no-cache-dir keras
Then it worked.
Looks like a cache problem, the cached package is different from REQUIREMENTS.
Perhaps caused by last updates interruption.
I did this which fixed my problem:
rm ~/.cache/pip -rf
You need to upgrade your pip into the newer version:
Using this command:
python -m pip install -upgrade pip
for Mac/Linux operating system and use
python -m pip install --upgrade tensorflow
for Windows to update your pip. Then run your command
pip install flask
In case you got this error while using pipenv try
$ pipenv --clear
$ pipenv lock
$ pipenv install
first, try to upgrade your pip then install the library
python -m pip install -upgrade pip
if it didn't work just try to install it without the cash
pip install --no-cache-dir the_library_name
I got the error during installing panads
You need to remove the cache and reinstall .
pip install --no-cache-dir flask
I had a similar issue for a different module. It was caused by network failure. My fix was nothing complex but another attempt at installing it and it worked.
maybe pipiserver(where you pip install from) upload a pkg for example flask-1.0.0.tar.gz, and rm is upload a new flask-1.0.0.tag.gz,if new pkg code has changed ,the hash must be different,there is two ways:
installl an older pkg version =, pip install flask==0.0.9
wait new pkg release flask==1.0.1 or cache expiration.
I have tried to clear pip cache with "-m pip cache purge" and using the "--no-cache-dir" argument but it was not helping.
In my case it was VPN being active during the attempts to install the package. As soon as I have turned it off everything worked as expected.
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.