Install VTK for python 3

Viewed 1311

I am under OSX (Mojave) and using Python 3.7.0. In order to install a python package to visualise results (Mayavi) I need to install vtk with python 3 bindings. I have installed python 3.7.0 with brew

I attempted the following:

  • python3 -m pip install vtk. I get:

    Collecting vtk
    Could not find a version that satisfies the requirement vtk (from versions: )
    No matching distribution found for vtk
    
  • brew install vtk --without-python@2does not allow to install the python 3 wrappers

  • brew install vtk --with-python --without-python@2 gives:

    [10%] Built target vtkCommonMath
    make: *** [all] Error 2
    
    READ THIS: https://docs.brew.sh/Troubleshooting
    
  • I also tried to follow this tutorial but I could not find VTK_WRAP_TCL in the available options of the ccmake. I set the following options:

    • PYTHON_EXECUTABLE :/usr/local/bin/python3

    • PYTHON_INCLUDE_DIR: /usr/local/Frameworks/Python.framework/Versions/3.7/include/python3.7m

    Compiling VTK goes fine. But when I try to compile the wrappers, the sudo make install gives:

    [100%] Built target vtkpython
    Install the project...
    -- Install configuration: "Debug"
    -- Installing: /usr/lib/libvtkCommonCorePython37D-8.2.1.dylib
    CMake Error at cmake_install.cmake:36 (file):
      file INSTALL cannot copy file "/Users/marco.magliulo/Software/vtkBuild/lib/libvtkCommonCorePython37D-8.2.1.dylib"
      to "/usr/lib/libvtkCommonCorePython37D-8.2.1.dylib".
    

Is there a simple way to get the python 3 wrappers that I did not try ? Is there something obvious that I am missing in the different attempts I made?

0 Answers
Related