In Ubuntu 24.04, to install Python packages that are not in the normal system's repository, you have to use an environment or specify a --break-packages option using python-pip. This is a problem because Nim tries to use the system's packages and not one from the virtual environment.
How would you call Python libraries from Nimpy in a virtual environment?
The easiest way to do this would be to do in bash before launching your Nim binary.
#!/bin/bash
nim c $(OPTIONS) $(MAIN) -o $(EXEC_BIN)
python3 -m venv $(VENV)
$(BINDIR)/$(EXEC_BIN)
OR
For me, this produced: /home/tkd/anaconda3/lib/libpython3.12.so.1.0.
Then in your Nim file, do:
import nimpy
import nimpy/py_lib
py_lib.pyInitLibPath("/home/tkd/anaconda3/lib/libpython3.12.so.1.0")
You can then import whatever Python package/library you want to use from the virtual environment.