OPNsense Forum

English Forums => General Discussion => Topic started by: datenimperator on August 26, 2026, 07:42:35 AM

Title: Recommendation on installing custom Python packages
Post by: datenimperator on August 26, 2026, 07:42:35 AM
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
Title: Re: Recommendation on installing custom Python packages
Post by: franco on August 26, 2026, 08:42:10 AM
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
Title: Re: Recommendation on installing custom Python packages
Post by: Patrick M. Hausen on August 26, 2026, 09:08:52 AM
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