Skip to content

I encountered the error error: externally-managed-environment while trying to install pytest following the "Get Started" guide. #15242

Open

Description

@adarrevah

I opened the pytest guide at https://docs.pytest.org/en/stable/getting-started.html and attempted the installation.
When I ran the command pip install -U pytest, I received the following error: error: externally-managed-environment.
As a beginner, I wouldn't know the next steps to successfully install the library. Furthermore, the error message suggests using the --break-system-packages flag, an action that could potentially break the operating system's Python installation and any tools that depend on it.
Your documentation page at https://docs.pytest.org/en/stable/explanation/goodpractices.html states: "For development, we recommend you use venv for virtual environments and pip for installing your application and any dependencies, as well as the pytest package itself." I would suggest adding a note next to the installation command explaining that it is recommended to perform the installation within a virtual environment, along with a link to an explanatory page.
Would you be open to a small PR that adds this?
My environment details:
Ubuntu 24.04.2 LTS (WSL)
Python 3.12.3 (system Python)
pip 24.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions