[vtkusers] python bindings question

Timothy O'Keefe timothy.okeefe at gmail.com
Fri Feb 8 09:39:51 EST 2013


Hi Eric,

That is consistent with what I uncovered. Last night I found the ccmake
"advanced mode" option so I was able to update the PYTHON_INCLUDE_DIR and
PYTHON_LIBRARY paths from system defaults to my custom locations (i.e. to
my python include dir and my libpython*.a).

Everything built fine and I was able to import the vtk module without any
errors. Of course I wish I could build the actual egg so that I can push it
to my python site-packages and not have to deal with PYTHONPATH. I can work
on that later though. For now, this is good progress.

Thank you,
Tim

On Fri, Feb 8, 2013 at 8:51 AM, Eric E. Monson <emonson at cs.duke.edu> wrote:

> Hey Tim,
>
> I may not know enough to help you, but I ran across a problem recently on
> my Mac system where I have two versions of Python installed. CMake was
> picking up the correct Python executable, since that was in my PATH, but it
> was finding the "wrong" python library. In my case it was finding
> /usr/lib/libpython2.7.dylib which was installed on the system originally,
> instead of one associated with my self-installed python version.
>
> Check all of those PYTHON_ variables in ccmake before you build to see
> whether they're all pointing to the versions you want.
>
> -Eric
>
>  · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On Feb 7, 2013, at 6:10 PM, Timothy O'Keefe <timothy.okeefe at gmail.com>
> wrote:
>
> 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
> BUILD_SHARED_LIBS, VTK_WRAP_PYTHON, and VTK_WRAP_TCL options. 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:
>
> $VTK_INSTALL_PREFIX/lib/python2.7/site-packages
>
> 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:
>
> $INSTALL_PREFIX/lib/vtk-5.10
>
> 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.
>
> Thanks,
> Tim
>  _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130208/467aec8e/attachment.htm>


More information about the vtkusers mailing list