Mailing List Archive

Vtk works fine, but not with Python ... ???
I'm using Python 1.5.2 under RedHat Linux 5.0. I have recently
downloaded and built vtk, including the Python wrappers. I have
followed the instructions given on the vtk web site (summarized
below), and the result is a version of vtk which works fine under tcl
and as a stand-alone. All example scripts I try to run via vtk work
perfectly.

However, when I try to run any vtk Python examples, I get the
following error no matter what script I try to run:

% python earth.py
Traceback (innermost last):
File "earth.py", line 4, in ?
from libVTKGraphicsPython import *
ImportError: /usr/local/lib/python1.5/lib-dynload/libVTKGraphicsPython.so:
undefined symbol: XtStrings

I'm wondering if anyone has seen this problem, or could suggest a way
to fix it.

Before you tell me that my LD_LIBRARY_PATH is set wrong, or that I
didn't run ldconfig, I want to point out that /usr/X11R6/lib is in my
LD_LIBRARY_PATH, and this directory contains the libXt.so, libXt.so.6
and libXt.so.6.0 libraries (two are symbolic links pointing to the
third one). Furthermore, my /etc/ld.so.conf file does contain
/usr/X11R6/lib, and running `ldconfig -v' indeed shows this library.

Also, the following vtk libraries have been successfully built and
installed in /usr/local/lib. And /usr/local/lib also appears in
LD_LIBRARY_PATH and /etc/ld.so.conf, and running `ldconfig -v' shows
these libraries:

libVTKCommon.so
libVTKCommonTcl.so
libVTKContrib.so
libVTKContribTcl.so
libVTKGraphics.so
libbVTKGraphicsTcl.so
libVTKImaging.so
libVTKImagingTcl.so
libVTKImagingPython.so
libVTKPatented.so
libVTKPatentedTcl.so

In addition, these libraries have been successfully built and put into
this Python subdirectory: /usr/local/lib/python1.5/lib-dynload ...

libVTKCommonPython.so
libVTKContribPython.so
libVTKGraphicsPython.so
libVTKPatentedPython.so

This directory is also in PYTHONPATH, LD_LIBRARY_PATH, and /etc/ld.so.conf

I set up user.make as follows:

TCL_INCLUDE=-I/usr/include
TCL_LIB=/usr/lib/libtcl.so

TK_INCLUDE=-I/usr/local/src/tk8.0.3/generic
TK_LIB=/usr/lib/libtk.so

MESA_INCLUDE=-I/usr/include/GL
MESA_LIB=/usr/lib/libMesaGL.so

PYTHON_INCLUDES=-I/usr/local/src/Python-1.5.2/Include

USER_CFLAGS = -O2 -D__NO_MATH_INLINES
USER_CXXFLAGS = -O2 -D__NO_MATH_INLINES


Then, I configured vtk as follows:

./configure --with-mesa --with-shared --with-python --with-tcl \
--with-tkwidget --with-x --with-contrib --with-patented

I then did the make, which took quite a while and ran successfully,
after which I installed the libraries, ran `ldconfig -v', and then
tried the examples. As I mentioned, every example I tried worked fine
except for the Python examples, which all give me the error I
described above. Note that all other Python modules I have are
working perfectly, including Tkinter, Pmw, Gadfly, and many others.

Any ideas?

Thanks in advance.

--
Lloyd Zusman
ljz@asfast.com
Vtk works fine, but not with Python ... ??? [ In reply to ]
> I'm using Python 1.5.2 under RedHat Linux 5.0. I have recently
> downloaded and built vtk, including the Python wrappers. I have
> followed the instructions given on the vtk web site (summarized
> below), and the result is a version of vtk which works fine under tcl
> and as a stand-alone. All example scripts I try to run via vtk work
> perfectly.
>
> However, when I try to run any vtk Python examples, I get the
> following error no matter what script I try to run:
>
> % python earth.py
> Traceback (innermost last):
> File "earth.py", line 4, in ?
> from libVTKGraphicsPython import *
> ImportError: /usr/local/lib/python1.5/lib-dynload/libVTKGraphicsPython.so:
> undefined symbol: XtStrings

No ideas but I'm in the same boat and get the same error, this under
Redhat 5.2.

I'd love to hear from somebody who's fixed this problem.
Vtk works fine, but not with Python ... ??? [ In reply to ]
Travis Oliphant <olipt@mayo.edu> writes:

> > I'm using Python 1.5.2 under RedHat Linux 5.0. I have recently
> > downloaded and built vtk, including the Python wrappers. I have
> > followed the instructions given on the vtk web site (summarized
> > below), and the result is a version of vtk which works fine under tcl
> > and as a stand-alone. All example scripts I try to run via vtk work
> > perfectly.
> >
> > However, when I try to run any vtk Python examples, I get the
> > following error no matter what script I try to run:
> >
> > % python earth.py
> > Traceback (innermost last):
> > File "earth.py", line 4, in ?
> > from libVTKGraphicsPython import *
> > ImportError: /usr/local/lib/python1.5/lib-dynload/libVTKGraphicsPython.so:
> > undefined symbol: XtStrings
>
> No ideas but I'm in the same boat and get the same error, this under
> Redhat 5.2.
>
> I'd love to hear from somebody who's fixed this problem.

I had the same problem, so I snet mail to the vtk user list, and I got
the following very helpful response from Jan Walter:
----------------------begin quote-------------------------
I'm not sure if I can help you but I had problems with the Python bindings in
VTK 2.1. I had to change some files to make it work. Maybe the same is true for
VTK 2.2:

configure.in:
VTK_SHLIB_BUILD_FLAGS="-shared -rdata_shared"

The "-rdata_shared" was added. I forgot the reason but it seemed to be helpfull.

Kits.make:
diff Kits.make Kits.make.org
99c99
< ${XLIBS} -lXext -lXt ${X_PRE_LIBS} -lX11 ${X_EXTRA_LIBS} ${DL_LIBS} \
---
> ${XLIBS} -lXext ${X_PRE_LIBS} -lX11 ${X_EXTRA_LIBS} ${DL_LIBS} \

The missing dependency for libXt.so seems to be the reason the error message:
undefined symbol: XtStrings
-----------------------end quote--------------------------

This solved the problem for me (with VTK 2.2).

Greetings,

Stephan Houben
Vtk works fine, but not with Python ... ??? [ In reply to ]
Lloyd Zusman wrote:

> % python earth.py
> Traceback (innermost last):
> File "earth.py", line 4, in ?
> from libVTKGraphicsPython import *
> ImportError: /usr/local/lib/python1.5/lib-dynload/libVTKGraphicsPython.so:
> undefined symbol: XtStrings
>
> I'm wondering if anyone has seen this problem, or could suggest a way
> to fix it.

Lloyd,

I believe you need to add -lXt to the link libs for
libVTKGraphicsPython.so.

--
Skip Montanaro | Mojam: "Uniting the World of Music"
http://www.mojam.com/
skip@mojam.com | Musi-Cal: http://www.musi-cal.com/
518-372-5583
Vtk works fine, but not with Python ... ??? [ In reply to ]
Lloyd Zusman <ljz@asfast.com> writes:

> However, when I try to run any vtk Python examples, I get the
> following error no matter what script I try to run:
>
> % python earth.py
> Traceback (innermost last):
> File "earth.py", line 4, in ?
> from libVTKGraphicsPython import *
> ImportError: /usr/local/lib/python1.5/lib-dynload/libVTKGraphicsPython.so:
> undefined symbol: XtStrings

That's a bug in the VTK makefiles. libVTKGraphicsPython.so must be linked
with the Xt library (add -Xt). Unfortunately I don't remember where
exactly this had to be added; the VTK Makefiles are a bit messy!
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron | Fax: +33-2.38.63.15.17
45071 Orleans Cedex 2 | Deutsch/Esperanto/English/
France | Nederlands/Francais
-------------------------------------------------------------------------------