solution for problem after updating pip: No module named pip

created at 07-06-2021 views: 4

problem after updating pip

environment: Win10

since the system keeps reminding me to update the pip version:

WARNING: You are using pip version 20.3.3; however, version 21.1.3 is available.
You should consider upgrading via the 'e:\project\fluidiml\venv\scripts\python.exe -m pip install --upgrade pip' command.

I did the upgrading with this command:

pip install --upgrade pip

then got this error prompt:

ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'e:\\project\\fluidiml\\venv\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.

Now we have a new problem to solve, after googling for a while, I found this solution:

python -m pip install --user --upgrade pip

Some say by adding a --user and it will be OK. But by running this we got the second problem, see bellow.

No module named 'pip'

the prompt says there's no pip anymore!

(venv) E:\project\FluidIML>python -m pip install --user --upgrade pip
E:\project\FluidIML\venv\Scripts\python.exe: No module named pip

Final solution

before updating, run python -m ensurepip first:

python -m ensurepip
python -m pip install --user --upgrade pip

and then pip will come back and be updated normally.

Please log in to leave a comment.