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

Install Python packages with OS not pip. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

llawall
Copy link

@llawall llawall commented Nov 4, 2023

Raspberry Pi OS bookworm warns:

{"changed": false, "cmd": ["/usr/bin/python3", "-m", "pip.main", "install", "openshift", "pyyaml"], "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 For more information visit http://rptl.io/venv\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"}

It might be a cleaner solution to create a venv in Python but I'm not familiar with Ansible nor do I know where these are used downstream so I've chosen to install them as OS packages here for simplicity.

@geerlingguy
Copy link
Owner

This may be the best solution here.

@jamestait
Copy link
Contributor

Came here to check if someone else had proposed this change. I dropped this task altogether and just put the packages in Ensure required dependencies are installed. -- alongside python3-pip and python3-setuptools -- but this works equally well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants