What is Fake IP and How to Mask Your IP
Learn safe methods to fake your IP—VPNs, proxies, Tor, and hosted endpoints—plus setup, tests, and security steps.
Nov 17, 2025
Learn why pip blocks system installs and how to fix error: externally-managed-environment with venv, pipx, apt/brew or safe overrides.
If you ran pip install and saw:
error: externally-managed-environment
× This environment is externally managed, and pip is being asked to do something that would modify it.
╰─> The project cannot be installed into this Python installation because the installation has been configured to disallow writes to site-packages.
This guide helps you understand the message and fix it safely with step-by-step commands. No prior deep knowledge required — just follow the copy/paste commands and the short verification tests.
macOS: open Terminal (⌘ + Space → type Terminal).
Linux: open Terminal (Ctrl+Alt+T).
Windows: open PowerShell (Win → type PowerShell) or Command Prompt (cmd).
Copy one command, paste it into the terminal, press Enter. If something fails, copy the exact output and search or ask for help.
This error stems from Python's PEP 668, introduced in Python 3.11 and enforced in distributions like Ubuntu 23.04+, Debian 12, Fedora, macOS via Homebrew, and Raspberry Pi OS (Bookworm). Your OS (or package manager) marked the system Python as externally managed to prevent pip from changing files the OS needs. This avoids breaking system apps.
In short: pip is blocked from modifying the system Python — which is intended to protect your computer.
Newer distributions and package managers (Debian, Ubuntu Bookworm, Raspberry Pi OS Bookworm, Homebrew-managed Python on macOS) mark system Python as externally managed (PEP 668).
If you try to install a package globally with pip install <pkg> (and not inside a virtual environment), pip refuses to modify system site-packages.
This prevents version conflicts and accidental breakage of OS tools (good!), but it can confuse beginners who are used to global pip installs.

Pick one based on what you want to do:
For project dependencies (libraries your code uses) → Use venv (virtual environment) — safest.
For command-line tools (global apps like semgrep) → Use pipx — easy and safe.
For system libraries required by OS-level services → Use your OS package manager (apt, brew).
If you must force a quick install → use --break-system-packages only in disposable/test environments (Docker/VM). Avoid on your main machine
Why: Keeps project packages isolated and avoids system damage.
Linux/macOS:
1. Create a project folder (optional):
mkdir myproject
cd myproject
2. Create the venv:
python3 -m venv .venv
Why this command? It makes a folder named .venv containing a private Python environment for this project.
3. Activate the venv:
source .venv/bin/activate
(You should see (.venv) in your prompt.)
4. Upgrade pip and install:
python -m pip install --upgrade pip
python -m pip install <package> # e.g., python -m pip install requests
5. Verify:
python -c "import requests; print('OK')"
6. Deactivate when done:
deactivate
Windows (PowerShell):
1. Create venv:
python -m venv .venv
If python doesn't work, try py -3 -m venv .venv.
2. Activate (PowerShell):
.\.venv\Scripts\Activate.ps1
Or in Command Prompt:
.\.venv\Scripts\activate.bat
3. Then python -m pip install <package> and test with:
python -c "import requests; print('OK')"
Troubleshoot common venv issues:
sudo apt update
sudo apt install python3-venv python3-distutils
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
Caution: Understand power of this setting — it allows locally-signed scripts to run.
Note for Web Scraping Beginners
Many users meet the “externally-managed-environment” error while installing scraping libraries such as requests, beautifulsoup4, scrapy, or httpx. These libraries often run thousands of HTTP requests, and once your project works correctly in a virtual environment, you may also need to handle rate limits or IP blocks. That’s where rotating proxies become essential for stable scraping.
Why: You want a CLI tool available globally (no venv activation) but isolated from system Python.
1. Install pipx:
# Debian/Ubuntu
sudo apt install pipx
pipx ensurepath
# macOS (Homebrew)
brew install pipx
pipx ensurepath
# or via pip (user-level)
python3 -m pip install --user pipx
python3 -m pipx ensurepath
2. Install a tool:
pipx install semgrep
semgrep --version
Use this when you truly need a system-level package (e.g., required by OS services).
Example (Debian/Ubuntu):
sudo apt update
sudo apt install python3-requests
Example (macOS/Homebrew):
brew install [email protected]
Note: Versions may lag behind pip; use only when OS integration is important.
Use this only in containers, VMs, or throwaway machines
Safer flag:
python3 -m pip install <package> --break-system-packages
Riskier: remove marker (high risk)
Find the marker:
sudo find /usr -name EXTERNALLY-MANAGED 2>/dev/null
Remove it (example):
sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED # replace with your path
DO NOT do this on machines you rely on daily.
Run these to confirm what you’re dealing with; it shows where pip would write files and whether the system marker is present.
1. Which Python:
which python3
python3 -V
2. Where pip points:
python3 -m pip --version
3. Is the environment externally-managed?
python3 -c "import sysconfig, os; p=sysconfig.get_paths()['stdlib']; print('stdlib:', p); print('EXTERNALLY_MANAGED?', os.path.exists(os.path.join(p,'EXTERNALLY-MANAGED')))"
If the last line prints True, your system Python is marked.
Raspberry Pi (Bookworm)
Example:
python3 -m venv ~/myenv
source ~/myenv/bin/activate
macOS (Homebrew)
Homebrew-managed Python may be marked externally-managed. Use pipx for tools or venv for projects.
Windows & WSL
Use py -3 or python depending on install. Example create venv: py -3 -m venv .venv.
Conda / Anaconda users
If you use Anaconda, prefer Conda environments:
conda create -n myenv python=3.11
conda activate myenv
conda install requests
Conda provides isolation similar to venv and avoids the externally-managed issue.
Even after creating a venv, tools sometimes still use system Python.
VS Code
1. Open Command Palette (Ctrl+Shift+P) → Python: Select Interpreter → choose ./.venv/bin/python.
2. Open the terminal inside VS Code — it usually activates the venv automatically.
3. Verify:
python -c "import requests; print('OK')"
PyCharm
Settings → Project → Python Interpreter → Add → Existing Environment → choose your .venv.
Docker (safe testing)
Create venv inside the image (see earlier Dockerfile pattern). Run and test in the container.
GitHub Actions (CI)
Create venv in the job and run tests inside it:
- run: |
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
pytest -q
Ansible (automation)
Create venv, install inside it, and run using the venv python.
Q: Can I just use --user to avoid this?
A: --user installs to your account’s site-packages and sometimes bypasses system checks, but it’s not as predictable or reproducible as venv. Prefer venv.
Q: Will removing the marker stop future OS updates?
A: It may cause conflicts with OS package management. Avoid unless you know what you’re doing.
Q: I use Anaconda/Conda — what should I do?
A: Use conda create -n myenv python=3.x and conda activate myenv — Conda provides environment isolation similar to venv.
Q: Is this error new?
A: The enforcement has been prominent since distributions adopted PEP 668 behavior; it’s common on more recent releases (e.g., Debian/Ubuntu Bookworm era onward).
PEP 668 and distribution behavior remain the standard. Recent releases of pip (2024–25) and pipx improved error messaging and now more clearly suggest creating a venv or using pipx — making it easier for beginners to follow best practices.
Always prefer venv for project libraries and pipx for CLI tools.
Verify with a tiny import test after install.
Use OS package manager only for system-level needs.
If you experiment with overrides, do it in Docker/VM.
Next step: Do a small practice. If you hit any specific error, copy the terminal output and paste it when asking for help — it makes debugging fast.
This error is frustrating, but it’s meant to protect your system. Build the discipline of using virtual environments and pipx — it saves hours of debugging and keeps your projects portable. When you must bypass protections, do it in throwaway VMs or containers, and always have backups.
Next >
Cancel anytime
No credit card required