Recommendation on installing custom Python packages

Started by datenimperator, Today at 07:42:35 AM

Previous topic - Next topic
I broke my 26.7 system by tinkering with packages, resulting in an incompatible kernel which would not boot. So I started new, restored my backup and ditched ISC on my way. Fresh 26.7 with no custom packages again.

The question remains: I'd like to install a daemon written in Python, which would require a number of Python extensions. In particular

- psutil
- paho-mqtt
- pyyaml

The packages names relate to the base python version, eg py312-psutil. How would I install that, without putting my system at risk? Regards

Christian

Hi Christian,

Long time no see. Hope you are doing good!

So you wouldn't break the kernel with ports but a major upgrade could fail although in reality your custom packages will just stop working.

Current Python is 3.13 and most Python ports are flavoured now so I'm not entirely sure how to build them from the command line.  But anyway load the ports tree:

# opnsense-code ports

(the utility will provide the ports and tools repositories and set up /etc/make.conf for you)

Go to the respective directories and build the matching version. You probably had a similar workflow before.


Cheers,
Franco

Alternatively create a dedicated user from the UI and in their home directory create a virtual environment.

https://docs.python.org/3/library/venv.html
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)