[vtkusers] python bindings question

Timothy O'Keefe timothy.okeefe at gmail.com
Thu Feb 7 18:10:48 EST 2013

I'm having difficulty installing and using the python VTK bindings.

My goal is to use VTK with my own version of python (2.7.3), one that I
maintain alongside the system-provided version (which is much older). This
is on a CentOS 5 platform.

I downloaded VTK 5.10.1, unpacked it, created a build directory, and ran
the usual ccmake, make, make install pipeline. I enabled the
configuration went fine. During the make stage, everything went fine except
towards the end when the build system tries to compile the python bindings
and/or tries to build the python egg. For whatever reason, the build system
really wanted me to install these into:


which is fine. The directory did not originally exist, so I created it,
re-ran make and everything was fine. I placed the directory on my
PYTHONPATH as well. Once the build completed, I tried to 'import vtk' in my
python interpreter and received the following error:

ImportError: libvtkCommonPythonD.so.5.10: cannot open shared object file:
No such file or directory

So I added the following location to my LD_LIBRARY_PATH:


which resolved the error. Unfortunately, I received a new error:

ImportError: $INSTALL_PREFIX/lib/vtk-5.10/libvtkPythonCore.so.5.10:
undefined symbol: _PyUnicodeUCS4_AsDefaultEncodedString

which to my understanding will occur when the library is compiled against a
version of python that uses 4 byte wide unicode characters and then you try
to import the module within a version of python that uses 2 byte wide
unicode characters. I don't know how this could happen at the moment, so I
could use a suggestion.

I'm trying to figure out how I could have managed to build VTK against a
different version of python than the one I have on my PATH. If anyone can
help out as I continue to hammer away at this issue, that would be
extremely helpful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130207/9d90464c/attachment.htm>

More information about the vtkusers mailing list