Building VTK with python bindings in linux (arch)
I came across VTK while building the docs for DIPY and what I needed was the python bindings.
I use arch linux so installing from pacman is simple:
But this fails to install the python bindings properly and when you try:
it throws the error:
That leaves no other way except to build VTK from source including the python wrapper, for the python version you want to use vtk in.
So here is the step by step procedure:
From vtk website download the latest source tarball. For me it is VTK-7.0.0.tar.gz then extract it:
Now configure cmake properly for building python wrappers:
This will give you an interface like: Now use your arrow keys to select the option you want to change and press enter to change value.
Toggle VTK_WRAP_PYTHON on.
Toggle VTK_WRAP_TCL on.
Change CMAKE_INSTALL_PREFIX to /usr
Change VTK_PYTHON_VERSION to 2.7 (or the version of python you want to use vtk in)
Now press [c] to configure
Then press [g] to generate and exit
Note: Sometimes you need to press c and g again.
Now run:
This will create a directory: Wrapping/Python
Now install the python bindings:
Hopefully that should install vtk properly.
To check, in python run:
This should give something like:
‘/usr/lib/python2.7/site-packages/vtk/init.pyc’
Posted with Tags: