Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2.5K
Views
Warning: pip is being invoked by an old script wrapper

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

over 4 years ago · Santiago Trujillo
11 answers
Answer question

0

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
over 4 years ago · Santiago Trujillo Report

0

You can solve it by upgrading pip:

pip install --upgrade pip
over 4 years ago · Santiago Trujillo Report

0

I've encountered the same problem after I updated pip to 20.1.x version through Pycharm. I've found one way to ensure that you can use pip install xxx in emergency case:

  1. Open the folder containing pip (e.g. C:\Program Files\Python37\Lib in my win10 laptop)
  2. You may find two folders separately belongs to the old version pip and newly installed pip (e.g. ./pip19_xxx for your old one and ./pip for the newly installed one
  3. Delete the folder of the new version pip (e.g. ./pip)
  4. (IF NECESSARY) Change environment PATH in windows10
  5. Test pip install xxx or python -m pip install xxx in cmd, it should work by now
over 4 years ago · Santiago Trujillo Report

0

Just use

 python -m pip install [module_name] 

This will resolve warning issue

over 4 years ago · Santiago Trujillo Report

0

Let me preface this by saying I am still very green with python and linux in general so I may be off base with my guidance here but I digress...

You might want check the location of the pip module you are invoking when you use the pipcommand. for me, I found out that when I would update and modify the pip command, it would update the pip file on my ~/.local/bin directory but when I would run it, it would default to the pip command located in the /usr/local/bin directory.

run the command

    pip install --upgrade pip

for me this command returned:

Defaulting to user installation because normal site-packages is not writeable Requirement already up-to-date: pip in ./.local/lib/python3.6/site-packages (20.1.1)

Note the file location and version (in bold).

check your path variables and the default pip that executes default by running the these 2 commands respectively

    echo $PATH

and

    which pip

god willing, they'll be congruent otherwise you'll have to either alter your the path variable directories making sure that the directory for your desired pip module is first or you'll have to delete the pip file from the director that you dont want use (i.e. the directory that came up when you ran which pip if that is not the same as the directory listed when you updated pip)

For me, removing the pip files in the usr/local/bin worked like a charm. Also check that the pip files that you want to use are referencing the correct version of python at the top of their scripts

#!/usr/bin/python3

# -*- coding: utf-8 -*-
import re
import sys

from pip._internal.cli.main import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

The other file originally referenced usr/bin/python (Python 2.7) instead of usr/bin/python3 (python 3.6.9) as I wanted initially.

Like I said before, I am just getting started with linux and python so take this with a grain of salt. Nevertheless, I no longer get this pip warning after taking these steps. Let me know if this helps at all.

over 4 years ago · Santiago Trujillo Report

0

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.

over 4 years ago · Santiago Trujillo Report

0

You can solve this problem by doing the following

1.Check that you are not having two versions of python.If you are having then uninstall one.

If the problem does not resolve after doing these then uninstall all the python installed in your pc and then again install it.

over 4 years ago · Santiago Trujillo Report

0

After the PIP upgrade, because the boot file (/usr/bin/pip) has not been changed, the old boot file is still used,

Old PIP startup file:

#!/usr/bin/python3
# GENERATED BY DEBIAN
import sys

# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
    sys.exit(main())

New PIP startup file:

#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys

from pip._internal.cli.main import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

The solution is as follows:

vi open /usr/bin/pip to add new code to save,

After this operation, there is no need to add "python -m" to run pip, and there will be no warning

over 4 years ago · Santiago Trujillo Report

0

This worked for me.

python3 -m pip install <package name>
over 4 years ago · Santiago Trujillo Report

0

I ran into the same issue on Ubuntu 18.04 with python 3.6 after I ran pip3 install --upgrade pip. (The original pip version installed by apt install python3-pip was 9.0, but I wanted pip >= 10.0 so I could use pip list -v.)

Step 1: Check the pip paths

I found that there were several pips installed in various locations on my machine, and it was causing problems. Use these commands to see which pips are being executed.

pip --version
pip3 --version
type -a pip pip3 # show all the locations for pip and pip3

Step 2: Fix the pip paths

This step will be highly individual. You have to figure out for yourself which one to keep and which ones to remove. Here are some example commands that may be helpful:

# remove ~/.local/bin/pip
cd ~/.local/bin
mv pip pip.bak
hash -r # important, reset bash command cache!

# remove the old pip 9.0
sudo apt purge python3-pip

Step 3: Upgrade pip

Run the commands from Step 1 again to verify everything looks good. Then upgrade pip:

pip3 install --upgrade pip

# if you get permission denied above, the install for --user
pip3 install --user --upgrade pip

# validate everything looks right
pip --version
pip3 --version
type -a pip pip3 # show all the locations for pip and pip3
over 4 years ago · Santiago Trujillo Report

0

I reinstalled Python by taking the reference of a Youtube video : https://youtu.be/rVb1TqqbPj0

It worked fine.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!