pimoroni / automation-hat

Python library and examples for the Pimoroni Automation HAT, pHAT and HAT Mini
https://shop.pimoroni.com/products/automation-hat
MIT License
122 stars 41 forks source link

Unable to install Automation HAT on "Raspbian GNU/Linux 12 (bookworm)" - error: externally-managed-environment #56

Closed monkeypashion closed 4 months ago

monkeypashion commented 9 months ago

Below is the output when running curl https://get.pimoroni.com/automationhat | bash

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 34800 100 34800 0 0 96156 0 --:--:-- --:--:-- --:--:-- 96398

This script will install everything needed to use Automation HAT

Always be careful when running scripts and commands copied from the internet. Ensure they are from a trusted source.

This script should -- only be run on a Raspberry Pi with RPi OS -- other systems and SBCs are not supported and may explode!

If you want to see what this script does before running it, you should run: 'curl https://get.pimoroni.com/automationhat'

Note: Automation HAT requires I2C communication

Do you wish to continue? [y/N] y

Checking environment... Updating apt indexes... ...............W: http://raspbian.raspberrypi.com/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details. ...... Installing python3-pip... ..................... Checking hardware requirements...

Checking for packages required for GPIO control... raspi-gpio is already installed .........RPi.GPIO installed and up-to-date

I2C must be enabled for Automation HAT to work I2C is now enabled

Checking packages required by I2C interface... Python 2 smbus installed and up-to-date ..................Python 3 smbus installed and up-to-date

Automation HAT comes with examples and documentation that you may wish to install. Performing a full install will ensure those resources are installed, along with all required dependencies. It may however take a while!

Do you wish to perform a full install? [y/N] ...y

Checking for dependencies... python3-sn3218 is required Installing python3-sn3218...

Installing python3-automationhat... install ok installed

Installing Automation HAT library for Python 3...

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. Python 3 library install failed! If problems persist, visit forums.pimoroni.com for support

helgibbons commented 4 months ago

Very sorry for the lack of reply here!

The updated installer should now attempt to set up a virtual environment for you, you'll need to activate it before running the examples with source ~/.virtualenvs/pimoroni/bin/activate.

Some more information about virtual environments (and why you now need one) can be found here, and updated installation instructions can be found here and here.

Closing for now - let us know if you're still stuck!