When I run this it fails: git clone https://github.com/pimoroni/weatherhat-python cd weatherhat-python sudo ./install.sh The error is i5-larry@raspberrypi:~/weatherhat-python $ ./install.sh weatherhat Python Library: Installer Checking Dependencies. Please wait... 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.
I had exactly this error message two weeks ago while installing Pimoroni’s blinkt library on a Pi 2 ZW running (for the first time) Bookworm 64-bit lite.
I’ve managed to solve my problem by first reading up on python virtual environments here:
…then, after doing a clean install of Bookworm, created a virtual environment: my_venv
After activating the environment, edited line 836 of Pimoroni’s blinkt library installer bash script :
if ! sudo -H $PIP3_BIN install --upgrade “$piplibname”; then
changing it to add an absolute path to my virtual environment (my_venv/bin) sub-folder:
if ! sudo -H ~/my_venv/bin/$PIP3_BIN install --upgrade “$piplibname”; then
Line 836 then installs pip into my virtual environment, and the installer script then runs to completion without generating the ‘externally-managed-environment’ error.
I’m assuming that like me, you’ve just started using Bookworm.
If you want any further help after reading Adafruit’s excellent guide, please ask, and I’ll post further details of my workflow.
I installing the weather-hat on the Raspberry PI 5 and changed the folder to weatherhat-python then I executed python3 -m venv --system-site-packages venv to created the Python virtual environment. I then ran source venv/bin/activate to activate the virtual folder. Then I ran ```
python3 -m pip install --upgrade pip. Then I ran ./install.sh. and Then i ran ./install. fonts font-manrope pyyaml adafruit-io numpythe. I deactivate the Python virtual environment. I rebooted. Then changed the folder to weatherhat-python/examples. I tried to run weather.py and it failed with an error Traceback (most recent call last):
File “/home/pi5-larry/weatherhat-python/examples/weather.py”, line 7, in
ModuleNotFoundError: No module named ‘ST7789’
I would suggest not to combine the weather-hat with the Pi5. Use a different Pi. The Pi5 is an oven, you won’t get reliable measurements. When using a different Pi, you can just use legacy bullseye and don’t have any problems.