Conversation
| The fix is to force the following environement variables (replace XX by your python version) before launching Idefix: | ||
|
|
||
| ```bash | ||
| export PYTHONPATH=$VIRTUAL_ENV/lib/python3.XX/site-packages:$PYTHONPATH |
There was a problem hiding this comment.
This has much more consequences and can easily create a worse situation for a user, especially if they see the export as a suggestion to hardcode this line into a .bashrc or similar config file.
I'd strongly advise against this.
There was a problem hiding this comment.
I don't see where it says this should be in .bashrc. My question would be: do you have a better proposition?
There was a problem hiding this comment.
to be more constructive, I would suggest making pydefix a proper Python package if it makes sense (and it doesn't, there is a bigger problem to address here)
There was a problem hiding this comment.
There was a problem hiding this comment.
the problem is not due to pydefix (a c++ class in idefix), but to pybind11, which is already a python package. On Idefix startup, pybind11 does not necessarily pick up the python interpreter from the current venv.
There was a problem hiding this comment.
What are the commands which are failing to reproduce with Idefix ?
I wanted to make a ticket for pybind11 but when trying to make a basic reproducer outside for them it looks to work on my setup ?
In the mean time, what I would export is the exact value taken by the python command :
export PYTHONPATH=$(python3 -c "import sys; print(':'.join(x for x in sys.path if x))")There was a problem hiding this comment.
also python3 isn't defined in all envs. I suspect at least some users might follow the documentation to the literal letter and turn out even more confused as a result.
It's becoming abundantly clear to me that trying to work around the problem may be more work than fixing it upstream.
There was a problem hiding this comment.
Agree.
What is the way to reproduce the problem with Idefix before I make a detailed ticket to pybind11 ?
There was a problem hiding this comment.
I've added a patch to #367 in order to detect the virtual env at the cmake stage and hard code it in the executable, so that PYTHONPATH is not needed on startup. I'll keep you posted if this works.
There was a problem hiding this comment.
Steps to reproduce:
in test/IO/pydefix
create a venv with python_requirements.txt
configure, compile and launch idefix. On my side, it uses the system's python, and fail to find matplotlib (required by the test), because pybind11 doesn't use the venv
No description provided.