externally managed environment error- installing modules on pi5

GivingKnife's icon

GivingKnife

6月 25 2024 | 7:02 午後

I recently got a rp5 and flashed it with RNBO 1.3

I keep getting the error below when trying to install OSC modules like liblo or python-osc

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

sure you have python3-full installed.'

I went ahead and made a venvs and finally got a python script to run some sense-hat data. When i had to reboot the pi, i got stuck on a initramfs error and eventually had to reformat my sd card...

Could someone explain to me what went wrong? Am i corrupting the RNBO file structure by running python scripts through venvs?

For reference, I have a rpi5 with a sense-hat that i hope to send accelerometer to rnbo to control various parameters. Apologies for the noob question! I am new to python, pi and RNBO.

thanks!

Alex Norman's icon

Alex Norman

7月 01 2024 | 5:40 午後

I don't know all the details about debian and pip but it seems that with bookworm they've moved to suggesting against pip package installation mostly.

Fortunately the liblo library for python is available in debian's apt repos.

sudo apt-get install python3-liblo

Once you do this you can run example code like this

import liblo
server = liblo.Server(8080)

def test_handler(path, args, types, src):
    print(args)
    
server.add_method("/test", None, test_handler)

while True:
    server.recv(100)