FormingSkillclaude-codepublished fresh until

pip: fix externally-managed-environment with a venv

Summary Create a project environment and invoke its interpreter explicitly; use pipx for a standalone command-line application. Keep the OS package manager in charge of system Python. Start with python -m venv .venv

Not for ModuleNotFoundError after a successful install, see python-modulenotfounderror-but-pip-installed-which-python-is-running

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
ASkill · v1.0.0Check the EXTERNALLY-MANAGED marker and print venv commands
How you use itYou ask for it
What it can doinstalls software · writes files · network · runs shell
What's inside
ASkill · v1.0.0Check the EXTERNALLY-MANAGED marker and print venv commands
How you use it
You ask for it
What it can do
installs software · writes files · network · runs shell
What's inside

What this thread does

Do first: create the project environment with python -m venv /path/to/new/virtual/environment, then install through its Python executable rather than a bare global pip command.

Short answer

As of November 2026, pip 26.3 was uploaded November 2, 2026; use its stable documentation and current Python packaging docs. The specification directs installers to check whether they run outside a virtual environment; a standalone CLI usually belongs in pipx. Don't remove the marker to install project libraries (PEP 668, current specification).

Choose / don't choose

  • Project environment: choose a project venv; don't install them into system Python or a CLI app's private pipx environment (venv).
  • Standalone command-line application: choose pipx install; pipx creates an isolated environment and exposes its commands. Don't use it as the project's importable library environment (pipx).
  • Distribution-owned software: choose the OS package manager's supported package. Don't use an override as an escalation after a project install fails (specification).
  • Project tool selection: for uv versus standard venv, see python-venv-or-uv-and-make-my-agent-use-the-project-environment; the marker policy applies independently of that choice.

Not for: ModuleNotFoundError after a successful install, see python-modulenotfounderror-but-pip-installed-which-python-is-running.

Settings that matter

Setting or flagValue / defaultApplies toSource
python -m venv.venv is the example project directory; select the intended base interpreter before creationCurrent Python docsvenv
-m pipAfter activation, use python3 -m pip on Unix/macOS or py -m pip on WindowsCurrent Python packaging guideinstall guide
sys.prefix / sys.base_prefixThey differ inside a venv; equality means this interpreter is outside oneCurrent external-management specificationspec
EXTERNALLY-MANAGEDInstallers check for the marker and whether they run outside a virtual environment; keep the distributor's marker in placeCurrent packaging specificationspec
--break-system-packagesLeave unset for this repair; it explicitly permits modifying an externally managed installationCurrent pip docspip option
pipx installPACKAGE should be a CLI application; pipx supplies a separate environment per appCurrent pipx docspipx

Order of operations

1. Create the environment with the intended Python using python -m venv /path/to/new/virtual/environment (creation). 2. Optionally activate it: source <venv>/bin/activate in POSIX bash/zsh, or <venv>\Scripts\Activate.ps1 in Windows PowerShell. Activation prepends the environment’s binary directory to PATH; it is unnecessary when using the explicit interpreter path (activation). 3. Install project requirements with python3 -m pip install -r requirements.txt on Unix/macOS, or py -m pip install -r requirements.txt on Windows, replacing the requirements file as appropriate (packaging guide). Run the project with that same interpreter. 4. If refusal persists, inspect the executable actually launched and whether its sys.prefix differs from sys.base_prefix. VIRTUAL_ENV cannot be relied upon to determine whether a virtual environment is being used (venv).

Known failures and fixes

Error (short quote)CauseFixSource
error: externally-managed-environmentpip targets a marked base interpreterUse pip in a virtual environmentspec

The discussion contains competing bypass advice; Flimm includes virtual environments and says never to remove or rename the marker. Distribution-specific package commands depend on the chosen OS.

Missing

  • Historical maciek97x (venv/pipx) and inoui (marker/override) attributions are not corroborated by the current discussion; use the linked official guidance. Flimm's attribution is present.
  • No OS/distributor is specified, so an exact distribution package command to repair missing venv support is not selected.

Checked

2026-11-12; pip 26.3 PyPI listing and current docs, November 2026. Python venv, packaging guide/specification, PEP 668, pip/pipx documentation and the dated discussion read. No environment creation or installation commands executed.

Started from a post by @Apoliticalboy (question); maciek97x, Flimm, inoui (answers), packaged by the editor. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# pip: fix externally-managed-environment with a venv
Summary: Create a project environment and invoke its interpreter explicitly; use pipx for a standalone command-line application. Keep the OS package manager in charge of system Python. Start with `python -m venv .venv`

## Options
- A · Check the EXTERNALLY-MANAGED marker and print venv commands · early, no verdict yet · installs software · writes files · network · runs shell
Copy for agent
get the whatworks thread pip-error-externally-managed-environment-use-venv-or-pipx and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread pip-error-externally-managed-environment-use-venv-or-pipx

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · Check the EXTERNALLY-MANAGED marker and print venv commands

Read-only diagnostic that reads the EXTERNALLY-MANAGED marker, reports venv exemption and prints venv commands without running them.

Format
Skill
Source
—
Pinned
v1.0.0 · sha256:89c58
Content hash
89c58f8a25df081a
Audit
scan passed
Can do
installs software · writes files · network · runs shell
Works with
claude-code
Check
Runs the bundled self-test fixtures; the check reads files only and changes nothing.
Author
@WhatWorks
Kudos
0

This package has no public source link yet.

Are you @WhatWorks? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package ww-pip-managed-check before installing
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp