Skip to content

WARNING: pip is being invoked by an old script wrapper Fix

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about WARNING: pip is being invoked by an old script wrapper Fix. We cover key concepts, practical examples, and best practices.

Pip shows WARNING: pip is being invoked by an old script wrapper when the pip command is a legacy wrapper that does not point to the actual pip installation.

The Wrong Way

pip install requests

This shows:

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.

The Right Way

Use the module invocation instead:

python3 -m pip install requests

Step-by-Step Fix

1. Use python -m pip

# Instead of: pip install requests
python3 -m pip install requests

2. Locate and fix the pip wrapper

which pip
# /usr/local/bin/pip
file /usr/local/bin/pip
# /usr/local/bin/pip: Python script, ASCII text executable

# Edit the pip script or reinstall pip
python3 -m pip install --upgrade --force-reinstall pip

3. Reinstall pip completely

python3 -m pip install --upgrade pip
hash -r  # refresh command hash
pip install requests  # should now work without warning

4. Check for multiple Python installations

which python3
which pip
python3 -m pip --version
pip --version
# If versions differ, use python3 -m pip consistently

Prevention Tips

  • Always use python3 -m pip instead of the bare pip command.
  • Avoid using system package managers (apt, yum) to install pip packages.
  • Reinstall pip after upgrading Python.
  • Use virtual environments to isolate pip versions.
  • Run hash -r after reinstalling pip to clear the command cache.

Common Mistakes with pip internals

  1. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  2. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  3. Using return to exit a function early instead of wrapping a pure value in the monad

These mistakes appear frequently in real-world PYTHON code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What causes the "old script wrapper" warning?

The pip executable script was installed by an older version of pip and was not updated when pip was upgraded. The wrapper script references an outdated import path that no longer works.

Is this warning dangerous?

No, it is non-fatal. Pip continues to function, but the warning indicates that pip will break after a future update. Fix it by running python3 -m pip install --upgrade pip.

Why does python -m pip work but pip fails?

python -m pip uses the current Python interpreter to locate and import pip directly. The pip command runs a wrapper script that may reference a different Python version or installation path.

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro