0

I'm trying to build the VTK library with python wrappers. I want to develop a python program to post-process some CFD results in VTK format.

I'm compiling the source in a local folder.

Unfortunately I'm facing several issues: firstly during the compilation I get the following error message:

CMake Error at Common/Core/cmake_install.cmake:47 (file):
file INSTALL cannot find
"/home/riccardo/Software/VTK/build/lib/libvtkCommonCore-8.0.so.1".

I tried to disable the option of shared libraries as suggested here VTK install error cannot find libvtkCommonCore-6.3.so.1 in the cmake configuration

cmake ..\
  -DCMAKE_INSTALL_PREFIX=/home/riccardo/Software/VTK/build \
  -DBUILD_SHARED_LIBS:BOOL=OFF \
  -DCMAKE_BUILD_TYPE=Release \
  -DVTK_USE_SYSTEM_ZLIB:BOOL=ON

In this case the compilation went fine but when I tried to import vtk in python I get this error:

from .vtkCommonCore import *
 42 from .vtkCommonMath import *
 43 from .vtkCommonMisc import *

 ~/Software/VTK/build/Wrapping/Python/vtk/vtkCommonCore.py in <module>()
    7     # during build and testing, the modules will be elsewhere,
    8     # e.g. in lib directory or Release/Debug config directories
---->   9     from vtkCommonCorePython import *

    ImportError: No module named 'vtkCommonCorePython'   

I really don't know how to fix it. Any help would be more than welcome.

Many thanks in advance!!!

  • I forgot; the OS is Ubuntu 16.04 and after the installation I have updated both my PYTHONPATH that LD_LIBRARY_PATH export PYTHONPATH=$PYTHONPATH:$HOME/Software/VTK/build/Wrapping/Python/:$HOME/Software/VTK/build/bin export LD_LIBRARY_PATH=$HOME/Software/VTK/build/bin:/usr/local/lib/:$LD_LIBRARY_PATH – rickyrubini Oct 21 '17 at 19:54
  • Possible duplicate of [ImportError: No module named vtkCommonPython](https://stackoverflow.com/questions/13495285/importerror-no-module-named-vtkcommonpython) – Cinder Biscuits Oct 21 '17 at 20:15
  • Yes, I have checked that question and I managed to make it work with python2.7 but not with python3.5 – rickyrubini Oct 22 '17 at 19:52

1 Answers1

0

Have you tried to tell CMake the python version you want to wrap?

That is, add:

-D VTK_WRAP_PYTHON:BOOL=ON \
-D VTK_PYTHON_VERSION:STRING=3.5 # or your python version
-D PYTHON_EXECUTABLE:PATH=\usr\bin\python3 # or wherever your python exec is

In the CMake configuration and see what happens.

ezatterin
  • 626
  • 5
  • 17