# Error: externally-managed-environment

**URL:** <https://forum.core-electronics.com.au/t/error-externally-managed-environment/19649>\
**Category:** Support\
**Created:** [12 April 2024 11:33 UTC](https://forum.core-electronics.com.au/t/error-externally-managed-environment/19649 "2024-04-12T11:33:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrian269437](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@Adrian269437](https://forum.core-electronics.com.au/u/Adrian269437)\
**Post date:** [12 April 2024 11:33 UTC](https://forum.core-electronics.com.au/t/error-externally-managed-environment/19649/1 "2024-04-12T11:33:20Z")

</div>

Hi there while following your steps in this youtube video [https://youtu.be/iOTWZI4RHA8?si=k2VKTpnPmFgl4Z6I](https://youtu.be/iOTWZI4RHA8?si=k2VKTpnPmFgl4Z6I)

when I type this command into my pi terminal sudo pip3 install numpy

I get this error.  
error: externally-managed-environment

× 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.

I follow the fixes but none work please help.

---

<div class="post-metadata">

**Author:** ![James46717](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@James46717](https://forum.core-electronics.com.au/u/James46717)\
**Post date:** [12 April 2024 23:16 UTC](https://forum.core-electronics.com.au/t/error-externally-managed-environment/19649/2 "2024-04-12T23:16:13Z")

</div>

This is related to the latest release of the Raspberry Pi OS, Bookworm. And is a decision by the developers of Debian not the Raspberry Pi Corporation. As the error says; you need to create a Virtual Environment. Understanding how this will work can be tricky at first. Anything that is full supported by Debian will not have this problem.

You could simply go back to Bullseye as it does not have this stipulation.

For one of my projects I needed to set up a Virtual Environment, eventually I got it to work. It was getting my head around how it worked. I think Core may have a guide on how to do this, unsure at this time.

Anyway, that is my understanding.

Regards  
Jim

EDIT: Some Links.

> **[Using Virtual Environments in Thonny on a Raspberry Pi - Tutorial Australia](https://core-electronics.com.au/guides/using-virtual-environments-in-thonny-on-a-raspberry-pi/)**
>
> This is a quick crash course on how to set up, use, and change virtual environments in Thonny on a Raspberry Pi.
> In late 2023 Bookworm OS for the Raspberry Pi rolled out and this new OS restricted the ability to install externally managed packages...

> **[Python Virtual Environment Usage on Raspberry Pi](https://learn.adafruit.com/python-virtual-environment-usage-on-raspberry-pi/overview)**
>
> How set up Python Virtual Environments as required by Raspberry Pi OS

> **[Python virtual environment](https://raspberrypi-guide.github.io/programming/create-python-virtual-environment)**
>
> A collection of tutorials to help set up and work with your Raspberry Pi

[https://raspberrypi-aa.github.io/session4/venv.html](https://raspberrypi-aa.github.io/session4/venv.html)

---

<div class="post-metadata">

**Author:** ![Adrian269437](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@Adrian269437](https://forum.core-electronics.com.au/u/Adrian269437)\
**Post date:** [15 April 2024 08:51 UTC](https://forum.core-electronics.com.au/t/error-externally-managed-environment/19649/3 "2024-04-15T08:51:12Z")

</div>

Hi Jim thank you for the response and the links I will follow those now.
