SSH Pi Connection

March 14, 2024, 01:07

_schmidty_

I am currently working with a raspberry pi 4 and a load cell sensor. The sensor is hooked up to the correct GPIO pins on the pi, but I need to install the correct packages to access them through python. I am currently accessing the pi through an SSH connection, but when I try to install a necessary package "pip3 install HX711", i get an error that "this environment is externally managed." I've tried running this connection through a VM and the install worked, so why am I getting this error for just this package? Other packages installed just fine. Nothing on the internet has worked/ been useful. Thanks!

hawwin

Did you try sudo apt install hx711?

hawwin

I mean

hawwin

Sudo pip3 install hx711

k9t33n

no that wouldnt work

k9t33n

this might

k9t33n

the reason your getting this error is because the python community for some reason wants to force venv. I forgot why but that's the way it is now

k9t33n

if your python package doesn't do much system wise then you can just add --break-system-packages to the end of the command that works

k9t33n

but as the command suggests it can break your system if it does do stuff system wise (yours does) so you need to activate a venv first and run the script in that

oops.se

To check if there is a package there is a feature in apt and that is list, example: sudo apt list hx711 or you can use wildcards sudo apt list hx or sudo apt list hx*.

_schmidty_

What I dont understand about venv (which is what I used) or any VM to access the terminal, is how would I save my progress or save it to the pi? Its all lost when I close my connection to the virtual environment right?

_schmidty_

And i have tried this, when trying it seems to be loading it until I get the error "Unable to locate package hx711" or any package for that matter

_schmidty_

Hmm, i actually cant find the package at all in lists. Weirdly enough, Ive also done the "apt update" and "upgrade" and still nothing. Sources on the internet claim that hx711 is a python package? whats going on?

k9t33n

you just save your python file out of venv but use it within one