[vtk-developers] Re: VTK Python Installation [was: VTK 5.0 branch in mid-August]

Brad King brad.king at kitware.com
Mon Aug 1 14:36:38 EDT 2005


Brad King wrote:
> Prabhu Ramachandran wrote:
> 
>> I had plans to make some small changes to the Python extension
>> modules.  The idea is to use the Apple approach, i.e. build a
>> vtk*PythonD.so and install that along with the other VTK libraries and
>> then build a separate vtk*Python.so that links to the vtk*PythonD.so.
>> This makes it much easier to install vtkpython.  However, this might
>> be too much of a change, so I am willing to do this after 5.0 is
>> released (maybe for 5.1).
> 
> 
> Take a look at how we do this in ITK:
> 
> http://www.itk.org/cgi-bin/viewcvs.cgi/Wrapping/CSwig/Python/itkbase.py.in?rev=1.8&root=Insight&view=auto 
> 
> 
> The itkbase.py script gets configured with all the information it needs 
> to load the wrapper modules from the proper directory.  One copy gets 
> created for the build tree and one copy gets created for the install 
> tree.  The installed one knows how to look relative to its location. The 
> modules get compiled with . in their rpath on UNIX (and the script sets 
> the cwd properly before loading them), and on Windows .dll files are 
> loaded from the proper directory anyway.  We just have to change the 
> installation to put the python .dll files in the bin directory with the 
> rest of the VTK .dll files.
> 
> As long as the .py modules are in the PYTHONPATH they can be configured 
> to get the .dll files from the proper location.

Looking at this in more detail it looks like there are actually no CMake 
install rules for VTK's Python wrappers.  Instead the python setup.py 
convention is used.  I understand the need to follow the python 
convention, but this is the only part of VTK that is not installed by 
the CMake INSTALL target.

Prabhu, I suggest the following approach.  We add CMake install rules 
that install the python wrappers into the VTK install tree.  Users may 
set PYTHONPATH to point at PREFIX/lib/vtk/python to use them.  This will 
be consistent with the Tcl install rules.  We then also provide a 
setup.py that can be run in the python convention that either copies the 
VTK wrappers over to the python install location or just installs a few 
small stub .py files that forward the import over to the VTK location.

Comments?
-Brad



More information about the vtk-developers mailing list