Installing specific package version with pip
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: Hypnotic Orient Looping
--
Chapters
00:00 Installing Specific Package Version With Pip
00:38 Answer 1 Score 44
00:51 Accepted Answer Score 1613
03:01 Answer 3 Score 769
03:21 Answer 4 Score 212
03:37 Thank you
--
Full question
https://stackoverflow.com/questions/5226...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #mysql #pip #pypi #mysqlpython
#avk47
ACCEPTED ANSWER
Score 1613
TL;DR:
Update as of 2022-12-28:
pip install --force-reinstall -v
For example: pip install --force-reinstall -v "MySQL_python==1.2.2"
What these options mean:
--force-reinstallis an option to reinstall all packages even if they are already up-to-date.-vis for verbose. You can combine for even more verbosity (i.e.-vv) up to 3 times (e.g.--force-reinstall -vvv).
Thanks to @Peter for highlighting this (and it seems that the context of the question has broadened given the time when the question was first asked!), the documentation for Python discusses a caveat with using -I, in that it can break your installation if it was installed with a different package manager or if if your package is/was a different version.
Original answer:
pip install -Iv(i.e.pip install -Iv MySQL_python==1.2.2)
What these options mean:
-Istands for--ignore-installedwhich will ignore the installed packages, overwriting them.-vis for verbose. You can combine for even more verbosity (i.e.-vv) up to 3 times (e.g.-Ivvv).
For more information, see pip install --help
First, I see two issues with what you're trying to do. Since you already have an installed version, you should either uninstall the current existing driver or use pip install -I MySQL_python==1.2.2
However, you'll soon find out that this doesn't work. If you look at pip's installation log, or if you do a pip install -Iv MySQL_python==1.2.2 you'll find that the PyPI URL link does not work for MySQL_python v1.2.2. You can verify this here: http://pypi.python.org/pypi/MySQL-python/1.2.2
The download link 404s and the fallback URL links are re-directing infinitely due to sourceforge.net's recent upgrade and PyPI's stale URL.
So to properly install the driver, you can follow these steps:
pip uninstall MySQL_python
pip install -Iv http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz/download
ANSWER 2
Score 769
You can even use a version range with pip install command. Something like this:
pip install 'stevedore>=1.3.0,<1.4.0'
And if the package is already installed and you want to downgrade it add --force-reinstall like this:
pip install 'stevedore>=1.3.0,<1.4.0' --force-reinstall
ANSWER 3
Score 212
One way, as suggested in this post, is to mention version in pip as:
pip install -Iv MySQL_python==1.2.2
i.e. Use == and mention the version number to install only that version. -I, --ignore-installed ignores already installed packages.
ANSWER 4
Score 44
I believe that if you already have a package it installed, pip will not overwrite it with another version. Use -I to ignore previous versions.