I'm implementing JEXL language in a C++ software named Orion Context Broker. As far as I know, there isn't direct support of JEXL in C/C++ so I'm using pyjexl Python module. Thus, I'm running a Python interpreter embedded in my C++ code that runs Python code based on pyjexl in sequence (the work is still in progress, but you can have a look here if you are interested).
In order for my code to work, pyjexl has to be installed in the system. I'm using Debian 12.4 and when I try to install using the usual sudo pip install pyjexl==0.3.0 I get this result:
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.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
I have tried with the first recommendation with no luck:
$ sudo apt-get install python3-pyjexl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python3-pyjexl
So I have continued with the next recommendation of using pipx, with same no luck (although maybe due to I'm not an expert in that tool I have done something wrong):
$ sudo pipx install pyjexl==0.3.0
Note: Dependent package 'future' contains 2 apps
- futurize
- pasteurize
No apps associated with package pyjexl. Try again with '--include-deps' to include apps of dependent packages, which are listed above. If you are attempting to install a library, pipx should not be used.
Consider using pip or a similar tool instead."
I could try to use a Python virtual environment for this but given that Orion Context Broker is implemented as a system service I think it is more appropriate to use a system package.
What's the recommended way of installing pyjexl in Debian systems? Is it safe to use the -break-system-packages option (seems risky...)? Any other alternative (not necessarily for pyjexl in particular but for other Python packages with the same situation in Debian)?