nomad
nomad copied to clipboard
Install PyNomad in virtual environment
The current installation instructions make very hard to install PyNomad in virtual enviroment, in fact the --user
option in the line
COMMAND python setup_PyNomad.py ${CMAKE_BINARY_DIR} ${NOMAD_VERSION} install
inside interfaces/PyNomad/CMakeLists.txt
overwrite the default setting of a virtual environment.
A separate parameter PYTHON_DIR
defined in CMake could allow the user to specify the correct Python location, otherwise the --user
flag could be removed to let the system the best location by itself.
Is there a way to install PyNomad in a virtual environment with the current code?
To answer your question: If you need that, do not build the Python module with the rest of the project.
-
Suppose we are dealing with the release
4.3.1
. -
Follow the instructions for building and installing Nomad.
-
Suppose it was built in
/some/path/nomad-v.4.3.1
and installed into/some/path/nomad-v.4.3.1/build/release
. Adjust these paths below to fit your situation. -
Navigate to
/some/path/nomad-v.4.3.1/interfaces/PyNomad
-
Compile the module manually. Suppose the root of the virtual environment is located at
/another/path/to/venv
. Execute
/another/path/to/venv/bin/python setup_PyNomad.py /tmp/nomad-v.4.3.1/build/release "4.3.1" build_ext --inplace
to compile the module. Please note that you'll need Cython available within that environment.
- Once the module is compiled, execute
/another/path/to/venv/bin/python setup_PyNomad.py /tmp/nomad-v.4.3.1/build/release 4.3.1 install --
to install it within the virtual environment.
Thanks for the suggestion. It works for me in a virtual environment.
I would just like to point out that in my case, I had to do this:
export LD_LIBRARY_PATH=$NOMAD_HOME/build/release/lib64/:$LD_LIBRARY_PATH
Otherwise I got the following error:
$ python runTest_BlockEval.py
Traceback (most recent call last):
File "/.../.../runTest_BlockEval.py", line 1, in <module>
import PyNomad
ImportError: libnomadUtils.so.4.3: cannot open shared object file: No such file or directory