[vtk-developers] Fixing VTK Python Installation
Prabhu Ramachandran
prabhu_r at users.sf.net
Thu Aug 11 14:46:01 EDT 2005
>>>>> "Brad" == Brad King <brad.king at kitware.com> writes:
Brad> Prabhu, I've just committed changes that cause VTK libraries
Brad> to be installed to PREFIX/lib instead of PREFIX/lib/vtk.
Brad> The Tcl wrappers have been updated to be installed for the
Brad> Tcl way of doing things. Since there were no python install
Brad> rules other than setup.py before I have left it unchanged,
Brad> so it is probably broken.
Thanks for letting me know. Can I go ahead change the
CMake/KitCommonBlock.cmake to use the Apple approach for Python?
Brad> Now that the VTK libraries have versions and are installed
Brad> in the proper place it is time to get the python install
Brad> working as we discussed. Do you have time to do this? We
Brad> are planning to branch 5.0 in the next week or two.
I will be in and out the next couple of weeks so will need a dashboard
buddy but can check in the changes.
Brad> Here are a couple concerns I still have:
Brad> 1.) If more than one version of VTK is installed (say 5.0
Brad> and 5.2) how can the desired version be selected by python?
Brad> In tcl one can write
[...]
Brad> What is the python equivalent for this? If everything goes
Brad> in site-packages how can multiple versions be installed?
As Sander pointed out this is possible but I don't really like the
wxPython solution. A more powerful, general and potentially widely
adopted solution to this problem is comming up via setuptools, Python
eggs and EasyInstall. See here:
http://peak.telecommunity.com/DevCenter/EasyInstall
My vote is to leave things simple right now so that everything works
for a single version of VTK (VTK-5.x). I don't see the need to work
up a hurried solution at this time with a non-standard approach that
we will have to support in the future.
Brad> 2.) I think running "make install" or building the INSTALL
Brad> target should be all that is needed to install VTK. It has
Brad> already been built with a specific version of python so it
Brad> needs to be installed in only one place. We could provide a
Brad> VTK_INSTALL_PYTHON_DIR cache entry that defaults to
Brad> lib/python-<version>/site-packages and is settable by the
Brad> user. Then the main install target could install things
Brad> directly to that location by automatically running a
Brad> disutils-style setup.py configured to get things from the
Brad> proper part of the build tree.
Alternatively, we could add a (fully documented)
VTK_PYTHON_SETUP_EXTRA_ARGS entry (in advanced?) where the user can do
whatever they want. So in the INSTALL rule one simply has to do the
following:
cd Wrapping/Python
python setup.py install ${VTK_PYTHON_SETUP_EXTRA_ARGS}
Brad> Is there any reason to require setup.py to be executed by
Brad> the user after building? I think if a setup.py is provided
Well, setup.py is useful to create a Python installer::
python setup.py bdist_wininst
Under windows will create an exe file that the user can install. In
the future this will be the approach to make Python eggs as well via:
python setup.py bdist_egg
However, the person who needs to do this may easily do so from the
build directory.
Brad> at all it should be in the source tree and it should know
Brad> how to build and install VTK with python wrapping. IIRC,
Brad> that would be consistent with other python extension module
Brad> sources.
Well, that looks like an incredibly complex task since we would have
to build all of VTK. I think it is OK to just go with a default
INSTALL rule that does what most would expect.
Let me think about this more and wait for some comments from other
Python folks here.
Just as a data point. When folks build wxPython from sources, this is
what they do:
1. Get the sources for wxPython. This bundles the wxWidgets sources
as well, so this is similar to what VTK has.
2. Read Robin Dunn's build instructions.
3. Build wxWidgets with appropriate options.
4. Install built wxWidgets.
5. Build wxPython using installed wxWidgets via setup.py.
6. Install wxPython also via setup.py.
This does take some work and is not meant for the average user. Most
users just install binaries.
A VTK-Python build would go like this:
1. Install CMake.
2. Download VTK sources.
3. Configure VTK.
4. Build VTK.
5. Install VTK.
If you know what you are doing you can use setup.py to do whatever
else is needed. I'll try and document it in
Wrapping/Python/README.txt.
cheers,
prabhu
More information about the vtk-developers
mailing list