Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: pip is being invoked by an old script wrapper

Tags:

python

pip

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.

When I directly type pip list to the terminal, I get the above warning. What does it mean exactly?

Should I always use it as python3 -m pip list? If I use it in that way, same output (list of packages) comes up without any warning.

p.s. : I am on ubuntu 18.10

like image 460
muyustan Avatar asked Feb 02 '20 18:02

muyustan


People also ask

How do you fix pip being invoked by an old script wrapper?

% pip3 install requests -q WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.

How do you update pip?

Updating Pip When an update for pip is available, and you run a pip command, you will see a message that says, “You are using pip version xy. a, however version xy. b is available.” You can run “pip install --upgrade pip” to install and use the new version of pip.


2 Answers

I faced the same issue but on Windows. Reinstalling pip worked for me. You can force a reinstall of pip with:

python -m pip install --upgrade --force-reinstall pip 

For Python3 Versions:

python3 -m pip install --upgrade --force-reinstall pip 
like image 163
Asad Rauf Avatar answered Sep 16 '22 11:09

Asad Rauf


I also faced the same problem when I switched to zsh shell from bash.

The solution was simple but I didn't notice it at first.

After I installed pip, I saw this warning

pip is being invoked by an old script wrapper

First I tried this solution

python3.8 -m pip install --upgrade --force-reinstall pip

But then I ran into this issue:

Screenshot from 2020-10-07 13-42-32

Then I searched how to add PYTHONPATH. I opened my .zshrc and say these lines were commented

# If you come from bash you might have to change your $PATH.

I uncommented the line that followed, and my misery vanished.

Screenshot from 2020-10-07 13-38-17

Now when I ran,

python3.8 -m pip install --upgrade --force-reinstall pip

Then the warnings of not in path disappeared in thin air, leaving me with a clean output.

Screenshot from 2020-10-07 13-55-34

I hope this would help anybody who ran into the same problem.

like image 29
aahnik Avatar answered Sep 20 '22 11:09

aahnik