0

i have a raspberry pi 5, and every time i try to install a new library (using pip) the following message appears

error: externally-managed-environmen×ばつ This environment is externally managed
╰─> To install Python packages system-wide, try apt install
 python3-xyz, where xyz is the package you are trying to
 install.
 
 If you wish to install a non-Debian-packaged Python package,
 create a virtual environment using python3 -m venv path/to/venv.
 Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
 sure you have python3-full installed.
 
 For more information visit http://rptl.io/venv
note: 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.
hint: See PEP 668 for the detailed specification.

can someone help please??

jsotola
7421 gold badge9 silver badges13 bronze badges
asked Jun 4, 2024 at 21:23
2
  • What are you ACTUALLY trying to install? Did you read the linked article? Commented Jun 4, 2024 at 23:02
  • You CAN use pip with venv BUT there is often a better way - depending on what you WANT to install, which you haven't stated. Commented Jun 7, 2024 at 7:24

2 Answers 2

0

Nothing to do with Pi5 - this is an issue with python 3.11 (which is well documented and extensively discussed) which requires pip to use a virtual environment.

Example (setting up in directory cp):- mkdir cp && cd cp && python -m venv --system-site-packages env

answered Jun 4, 2024 at 22:59
1

Most python packages are available from the distro package manager and that's the better way to install them if you want them available on the system generally; I think per-user packages have been superceded by the venv restriction mentioned by Milliways.

To search for a python package by name:

> apt search python3 gpiozero
Sorting... Done
Full Text Search... Done
python3-gpiozero/stable 1.6.2-1+b1 armhf
 simple interface to everyday GPIO components used with Raspberry Pi (Python 3)

You can then install that w/ sudo apt install python3-gpiozero.

If the package doesn't show up that way, try:

apt search python3 | grep -C 3 -i gpiozero

grep is a text matching tool; see man grep for an explanation of the switches.

answered Jun 6, 2024 at 15:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.