[vtk-developers] about vtk python bindings and Qt
Clinton Stimpson
clinton at elemtech.com
Mon Sep 20 11:55:02 EDT 2010
Yes, I've come across the issues you see.
I've got a patch to make it work from a "make install" but it breaks when run
from a build tree, which also means it breaks tests.
Unfortunately, SIP embeds the name of dependent modules in binaries, so if I
choose "vtk.vtkCommonPythonSIP" it works when installed. If I choose
"vtkCommonPythonSIP" it works in the build tree.
Clint
On Monday, September 20, 2010 09:46:23 am Eric E. Monson wrote:
> Hey Clint,
>
> Just in case this will be helpful to you in developing the PythonSIP
> install rules. I know it's a bit rambling, but hopefully it will make some
> sense.
>
> On OS X, without the new SIP stuff, I usually don't do a "make instal" into
> /usr/local, but I do go to [vtk_src]/build/Wrapping/Python and do a "sudo
> python setup.py install", which puts all of the VTK Python stuff in an egg
> inside of my site-packages so that I don't have to set the PYTHONPATH at
> all, but can still "import vtk".
>
> With your SIP stuff, to make "import vtk" work without explicitly setting
> the PYTHONPATH env variable, I have to copy both libvtkQtPython.so and
> QVTKPython.so to the site-packages/VTK-5.7.0-py2.6.egg/vtk directory.
>
> But, somehow with the way that QVTKPython.so imports other modules, even if
> all of the *PythonSIP.so libraries are sitting in the same directory as
> the *Python.so files, they're not "seen" when qvtk.py tries to run "from
> QVTKPython import *". (I get a LinkError: No module named
> vtkFilteringPythonSIP.) The *PythonSIP.so libraries seem to need to be in
> the PYTHONPATH for "import vtk" to work and really import QVTKWidget. I
> can do a bit of a hack and copy all of them into the
> site-packages/VTK-5.7.0-py2.6.egg/ directory, which is added to the
> PYTHONPATH by setup tools, but that seems like a non-standard place to put
> them.
>
> One of the main reasons I bring this up is that it also impacts me when I
> try to create a standalone application bundle with my PyQt/VTK work. I've
> been using bundlebuilder and CMake's fixup_bundle to create the app
> bundles, and there, too, the only way I've figured out how to make it work
> with QVTKWidget is to put all of the *PythonSIP.so libraries in sort of a
> non-standard place (not with the rest of the VTK *Python.so files) so
> they'll be "seen".
>
> As you can tell, I'm not an expert in any of this, but I guess I'm just
> passing it along in case it will either help with making install rules, or
> in case there is some other way of coding the SIP stuff so that the
> *Python.so and *PythonSIP.so files could all be installed in the same
> spot.
>
> Thanks for putting up with my ramble, and for all the good work getting
> QVTKWidget wrapped.
>
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
> On Sep 16, 2010, at 12:34 PM, Clinton Stimpson wrote:
> > Ok, I see that it is installing libvtkQtPython to the wrong location.
> > As a workaround until it is fixed, you can add /usr/local/lib/vtk-5.7/ to
> > your PYTHONPATH.
> >
> > Clint
> >
> > On Thursday, September 16, 2010 10:07:11 am Nicola Creati wrote:
> >> This is the error:
> >>
> >> Traceback (most recent call last):
> >> File "<stdin>", line 1, in <module>
> >> File
> >>
> >> "/usr/local/lib/python2.6/dist-packages/VTK-5.7.0-py2.6.egg/vtk/qvtk.py"
> >> , line 8, in <module>
> >>
> >> from libvtkQtPython import *
> >>
> >> ImportError: No module named libvtkQtPython
> >>
> >>
> >> My libvtkQtPython.so and libvtkQtPythonD.so are located in
> >> /usr/local/lib/vtk-5.7/.
> >>
> >> Nicola
More information about the vtk-developers
mailing list