Installation and setup

Python installation

This package requires Python >= 3.6. Assuming you have the correct version of Python installed, you can install netneurotools by opening a terminal and running the following:

git clone https://github.com/netneurolab/netneurotools.git
cd netneurotools
pip install .

Alternatively, you can install netneurotools directly from PyPi with:

pip install netneurotools

Optional installation for surface plotting

In order to use surface plotting functionality like netneurotools.plotting.plot_fsaverage(), you will need a working vtk/mayavi/pysurfer installation. These can generally be installed with the following command:

However, we include instructions below for installing the bleeding-edge version of the dependencies. Note: if you already have a working mayavi/pysurfer installation, there is generally no need to follow these instructions!

  • Install Qt

    • Installing Jupyterlab using conda (conda install jupyterlab) should automatically install the required qt/pyqt packages.

    • If otherwise, using pip install PyQt5 should also work as suggested by here and here

    • If not working, search for the error prompts like this.

  • Install VTK

    • Official wheels for the latest VTK9 are available for download here.

    • For Python>=3.9, official wheel is not available at the moment. Following here and here, it’s possible to build the wheel. See the example code below.

git clone https://github.com/Kitware/VTK
cd VTK

mkdir build
cd build
PYBIN=<PATH TO YOUR PYTHON EXECUTABLE>
cmake -GNinja -DVTK_BUILD_TESTING=OFF -DVTK_WHEEL_BUILD=ON -DVTK_PYTHON_VERSION=3 -DVTK_WRAP_PYTHON=ON -DPython3_EXECUTABLE=$PYBIN ../

# optionally, apt install ninja
ninja
$PYBIN setup.py bdist_wheel

# to install
pip install dist/vtk-*.whl
  • Install mayavi

    • Install from source pip install git+https://github.com/enthought/mayavi.git

  • Install pysurfer

    • Install from source pip install git+https://github.com/nipy/PySurfer.git

  • Install netneurotools

    • Install from source pip install git+https://github.com/netneurolab/netneurotools.git

Troubleshooting

  • Error related to from tvtk.vtk_module import VTK_MAJOR_VERSION

    • Currently not fixed

    • Temporary workaround: adding VTK_MAJOR_VERSION = 9 to mayavi/tvtk/vtk_module.py

  • Error related to GLX

    • Try glxgears or glxinfo

    • Check display driver compatibility