You are using pip3 to install flask-script which is associated with python 3.5. However, you are trying to upgrade pip associated with the python 2.7, try running pip3 install --upgrade pip.
It might be a good idea to take some time and read about virtual environments in Python. It isn't a best practice to install all of your packages to the base python installation. This would be a good start: http://docs.python-guide.org/en/latest/dev/virtualenvs/
Answer from JanHak on Stack OverflowYou are using pip3 to install flask-script which is associated with python 3.5. However, you are trying to upgrade pip associated with the python 2.7, try running pip3 install --upgrade pip.
It might be a good idea to take some time and read about virtual environments in Python. It isn't a best practice to install all of your packages to the base python installation. This would be a good start: http://docs.python-guide.org/en/latest/dev/virtualenvs/
To upgrade your pip3, try running:
sudo -H pip3 install --upgrade pip
Your pip may move from /bin to /usr/local/bin
To upgrade pip as well, you can follow it by:
sudo -H pip2 install --upgrade pip
Pip upgrade to 22.3 windows10 - Packaging - Discussions on Python.org
Pip keeps telling me to upgrade pip, even right after upgrading pip
Oops! upgraded root's pip3 with python3 -m pip install --upgrade pip - How to reset to RHEL8 default?
RUN pip install --upgrade pip and RUN pip install -r requirements.txt not working
Videos
I usually just run the following commands to upgrade both pip2 (=pip by default) and pip3:
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
You must make sure that you upgrade the version (for Python 2 or 3), which you want to react on the command pip without number, last.
Also please note that this keeps the old packaged versions installed through apt-get or any other package manager, but adds new versions which have nothing to do with the system packages. The pip-installed packages will be preferred, but you should not remove the apt-get-installed ones either, because the package manager can't know that any pip version is installed otherwise.
I think the
pip install --upgrade pip
command does not work properly anymore. The correct command should be:
for Python 3:
python3 -m pip install --upgrade pipfor Python 2:
python2 -m pip install --upgrade pip
P.S. If you want to make sure your other Python packages are also up to date, follow the instructions here.
» pip install pip
To upgrade pip using pip is a bit different than regular command. Use
python -m pip install --upgrade pip
Here python -m will read the pip library file as a script and you will be able to update.
If you were like me you had created a virtual environment in a project folder.
python -m venv env
So in order to make the pip upgrade work, go into the Scripts folder of the env folder.
Then run .\python -m pip install --upgrade pip.
Ditto with any pip installs. Same folder .\pip install ....
The .\ pins it to the command in the current folder, be it pip or python.
(I was doing this on Windows. But ./ would be the equivalent for Unix variants)
PS: I also ran those commands as Administrator - so sudo the commands if things fails.
On some RHEL8.3 box's I've accidentally upgraded root's pip version with an ansible playbook because I did not set become_user=appuser in the pip module. So it took the become for the playbook with root. I required a newer version of pip 20.x for a module for an application user only. I've gotten that done with --user argument for new deploys but I need to fix existing 4 servers.
Doing some reading around it was pretty obviously this was a bad idea!! Is there a way to get the system-wide pip state back to normal?
The default is using pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
located /usr/bin/pip3
/usr/bin/pip3 -> /etc/alternatives/pip3
python3 -m pip install --upgrade pip
After the mistake pip is 20.3.3 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
I've since used python3 -m pip install pip --upgrade --user and/or updated the ansible with become_user=appuser.
Couple things I've tried that did not work. I've been setting up fresh VMs the last 3 hours and can't find a solution.
-
Ran python3 -m pip install pip=9.0.3 but this is just 9.0.3 on /usr/local/ instead of /usr/lib.
-
update-alternatives because I noticed python3 is in "manual" now compared to "auto" on a fresh rhel8 install.
-
yum reinstall of pip packages.
-
yum reinstall of python3
-
yum remove and install python3 (I don't think removing python3 is a good idea just wanted to test it - it did not fix pip).
Any help is much appreciated.