Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install PyNomad in virtual environment #122

Open
lucagrementieri opened this issue Dec 29, 2022 · 3 comments
Open

Install PyNomad in virtual environment #122

lucagrementieri opened this issue Dec 29, 2022 · 3 comments

Comments

@lucagrementieri
Copy link

lucagrementieri commented Dec 29, 2022

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?

@jan-provaznik
Copy link
Contributor

To answer your question: If you need that, do not build the Python module with the rest of the project.

  1. Suppose we are dealing with the release 4.3.1.

  2. Follow the instructions for building and installing Nomad.

  3. 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.

  4. Navigate to /some/path/nomad-v.4.3.1/interfaces/PyNomad

  5. 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.

  1. 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.

@ctribes
Copy link
Contributor

ctribes commented Jan 9, 2023

Thanks for the suggestion. It works for me in a virtual environment.

@davidmurray
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants