Software⏱️ 2 min read📅 2026-05-30

How to Fix: How do I solve "error: externally-managed-environment" every time I use pip 3

Error resolving Python package installation on Linux due to externally-managed environment.

Quick Answer: Try installing packages using apt instead of pip, e.g. apt install python3-xyz.

The 'externally-managed-environment' error occurs when you're trying to install Python packages using pip on a Linux machine that's managed by an external package manager like apt. This is because pip installs packages system-wide, whereas apt manages the package installation for the entire system.

💡 Why You Are Getting This Error

  • [Cause]

✅ Best Solutions to Fix It

Method 1: Update pip

  1. Step 1: Run the command pip install --upgrade pip to update pip.

Method 2: Use apt instead of pip

  1. Step 1: Run the command apt install python3-xyz to install Python packages system-wide.

💡 Conclusion

By following these methods, you should be able to resolve the 'externally-managed-environment' error and successfully install Python packages using pip on your Linux machine.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions