Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PIP_BREAK_SYSTEM_PACKAGES to the pip module #486

Merged
merged 1 commit into from
Oct 11, 2023
Merged

Conversation

vitabaks
Copy link
Owner

@vitabaks vitabaks commented Oct 11, 2023

Issue: #447

Python 3.11 introduces PEP 668, which marks Python base environments as “externally managed”.
Consequently, on Debian 12, installations using pip3 may encounter the externally-managed-environment error as shown below:

fatal: [xxxxx]: FAILED! => {"changed": false, "cmd": ["/usr/bin/pip3", "install", "-U", "--trusted-host=pypi.python.org", "--trusted-host=pypi.org", "--trusted-host=files.pythonhosted.org", "setuptools<66.0.0"], "msg": "\n:stderr: error: externally-managed-environment\n\n× This environment is externally managed\n╰─> To install Python packages system-wide, try apt install\n    python3-xyz, where xyz is the package you are trying to\n    install.\n    \n    If you wish to install a non-Debian-packaged Python package,\n    create a virtual environment using python3 -m venv path/to/venv.\n    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make\n    sure you have python3-full installed.\n    \n    If you wish to install a non-Debian packaged Python application,\n    it may be easiest to use pipx install xyz, which will manage a\n    virtual environment for you. Make sure you have pipx installed.\n    \n    See /usr/share/doc/python3.11/README.venv for more information.\n\nnote: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.\nhint: See PEP 668 for the detailed specification.\n"}

To address this, this PR introduces the environment variable PIP_BREAK_SYSTEM_PACKAGES=1. This ensures that pip3 can install packages without being restricted by the externally managed environment constraints set by PEP 668.

@vitabaks vitabaks self-assigned this Oct 11, 2023
@vitabaks vitabaks changed the title Add PIP_BREAK_SYSTEM_PACKAGES for pip module Add PIP_BREAK_SYSTEM_PACKAGES to the pip module Oct 11, 2023
@vitabaks vitabaks merged commit c030eea into master Oct 11, 2023
18 checks passed
@vitabaks vitabaks deleted the pip-system branch October 11, 2023 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant