Slicer in a python pipeline (but not in the slicer python interpretor)

I would like to use slicer in a python pipeline that will be executed on a large cluster in a batch mode.

I succeed to execute the python code on my laptop:

  • thanks to the Slicer3D JupyterKernel kernel extention.
  • thanks to a external python env, throw jupyter (after having executing this command jupyter-kernelspec install "/home/jacquemi/usr/local/Slicer-5.0.2-linux-amd64/NA-MIC/Extensions-30822/SlicerJupyter/share/Slicer-5.0/qt-loadable-modules/JupyterKernel/Slicer-5.0" --replace --user)

But I did not succeed to install slicer (using pip or whatever) in an external Python virtualenv without using jupyter. As I need to execute my pipeline into a cluster in batch mode, I cannot use neither Jupyter nor the 3D slicer python interpreter

So is there a way to install slicer Python library in a virtual
venv and to load (and use) it in a simple python session (not a jupyter one) ?

This documentation indicates that : “Python scripting and development of new Slicer modules in Python does not require building the application either”

No, Slicer needs to use Slicer’s python build for all the dependencies to work. You should be able to run Slicer from a directory available to your cluster node. You can use xvfb to get an X session if it’s not available on your node. This requires some memory (real or virtual) on the node, but this is usually manageable and small compared to a large computing task requirement.

That means you can use Slicer’s python to develop Slicer modules, but you still need Slicer itself.

As a future goal we’d like to support installing parts of Slicer as packages for standard python systems but this isn’t possible currently.