1

The specific question at hand is:

How could I install the nest module of a NEST simulator installation into a specific site-packages directory of for example a pyenv/virtualenv?

But a broader explanation on how the Python module is generated and installed during the NEST CMake itself is certainly welcome. For example, where's the setup.py file that's used to install the Python files, I notice some egg-info files typical for pip? I suppose that if I knew that I could use pip to install the module anywhere I wanted. Another side-question is whether the Python module install target is configurable from CMake?

Robin De Schepper
  • 4,942
  • 4
  • 35
  • 56

1 Answers1

1

NEST is not a Python package and the Python modules rely on libraries of the compiled modules being available in known locations. When using for example a Conda flavor, you can install NEST with cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX (when inside the target environment) to have everything installed into the environments directory tree.

For the self-built modules, the same requirements hold and in addition to the .py files being in a directory where the corresponding Python looks for its modules (e.g. .../site-packages), the created .so files need to be in a place where the dynamic loader can find them.

Try to copy the .so file into the NEST install directory path/to/installed/lib/nest/ and the python files into the site-packages for your environment. pynest itself also has a setup.py that you find in your build directory in pynest/setup.py. The python package is however not meant to be distributed separately, because of the aforementioned binary dependencies.

Be aware that you have to take care about consistency. You can not use a module compiled for one Python version with another Python, etc. Generally, the dependencies are a tricky thing and using e.g. libGSL in your module should also be the same one as used when compiling NEST, etc. This goes down to basically also using the same compiler.

TerhorstD
  • 265
  • 1
  • 2
  • 12
  • Oh so I could simply move the produced `lib/pythonX.Y/site-packages/nest` folder to the python env I wanted without breaking things? (Assuming they're the same Python version) And is that a no then on telling CMake where to install the module to rather than `lib/pythonX.Y/site-packages/nest`? – Robin De Schepper Sep 27 '20 at 23:27
  • I've also edited the title to reflect that I understand the difference between NEST and it's generated Python bindings ;) I'm in this question interested in what possible install behaviors there are for the Python module – Robin De Schepper Sep 28 '20 at 00:18