How do I update/upgrade pip itself from inside my virtual environment?
This video is brought to you by Memorabit, an app that sends technical terms, commands and definitions as reminders at unexpected moments, so they stay in memory. Built on cognitive science principles. Start free on web, iOS and Android:
iOS: https://apps.apple.com/app/id6782301691
Android: https://play.google.com/store/apps/detai...
--------------------------------------------------
Read the revolutionary AI books written by Turbina Editore, the first publishing house entirely run by artificial intelligence. This groundbreaking publisher has transformed the literary world, producing the most sought-after AI-generated books. Start reading today at:
https://turbinaeditore.com/en/
--------------------------------------------------
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT
Music by Eric Matyas
https://www.soundimage.org
Track title: Forest of Spells Looping
--
Chapters
00:00 How Do I Update/Upgrade Pip Itself From Inside My Virtual Environment?
00:36 Accepted Answer Score 1692
00:54 Answer 2 Score 134
01:12 Answer 3 Score 56
01:26 Answer 4 Score 21
02:19 Thank you
--
Full question
https://stackoverflow.com/questions/1522...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #upgrade #virtualenv #pip #packagemanagers
#avk47
ACCEPTED ANSWER
Score 1692
pip is just a PyPI package like any other; you could use it to upgrade itself the same way you would upgrade any package:
pip install --upgrade pip
On Windows the recommended command is:
py -m pip install --upgrade pip
ANSWER 2
Score 134
The more safe method is to run pip though a python module:
python -m pip install -U pip
On windows there seem to be a problem with binaries that try to replace themselves, this method works around that limitation.
ANSWER 3
Score 56
In my case my pip version was broken so the update by itself would not work.
Fix:
(inside virtualenv):easy_install -U pip
ANSWER 4
Score 21
I tried all of these solutions mentioned above under Debian Jessie. They don't work, because it just takes the latest version compile by the debian package manager which is 1.5.6 which equates to version 6.0.x. Some packages that use pip as prerequisites will not work as a results, such as spaCy (which needs the option --no-cache-dir to function correctly).
So the actual best way to solve these problems is to run get-pip.py downloaded using wget, from the website or using curl as follows:
wget https://bootstrap.pypa.io/get-pip.py -O ./get-pip.py
python ./get-pip.py
python3 ./get-pip.py
This will install the current version which at the time of writing this solution is 9.0.1 which is way beyond what Debian provides.
$ pip --version
pip 9.0.1 from /home/myhomedir/myvirtualenvdir/lib/python2.7/dist-packages (python 2.7)
$ pip3 --version
pip 9.0.1 from /home/myhomedir/myvirtualenvdir/lib/python3.4/site-packages (python 3.4)