[vtk-developers] python install prefix in setup.py

David Gobbi dgobbi at atamai.com
Fri Feb 3 10:36:57 EST 2006


Prabhu Ramachandran wrote:

>"David" == David Gobbi <dgobbi at atamai.com> writes:
>  
>
>    David> Prabhu Ramachandran wrote:
>    >> distros.  Debian basically adds the local prefix to site.py.
>[...]
>    David> Does debian have any way of telling distutils of the new
>    David> location?  If we are using setup.py to install the python
>    David> modules, then it seems that our default location should be
>    David> the same as the one used by setup.py (otherwise, why would
>    David> we use setup.py at all wh
>
>Not that I know of but this could be used:
>
> import site
> print site.prefixes
>  
>
Y

>    >> I am not sure that David's approach is *the* optimal one.  Many
>    >> VTK users are unlikely to have root access therefore installing
>    >> to /usr/ is entirely out of question.  In these cases it is
>    >> best to do what is currently done -- install to CMAKE_PREFIX.
>    >> Basically the install should work for most common situations.
>    >> 
>    >> 
>    David> I disagree that we should install to
>    David> ${CMAKE_PREFIX}/lib/pythonx.x/site-packages, as is
>    David> currently done.  It might make sense to install in
>    David> ${CMAKE_PREFIX}/lib/vtkx.x/python
>
>${CMAKE_PREFIX}/lib/vtkx.y/python is completely non-standard.  No
>Python module ever installs importable Python modules in
>lib/libname/python.  Any normal distutils based Python package is
>installed like so:
>
> python setup.py install --prefix=$pth
>
>and everything is installed in 
>
> $pth/lib/site-packages/pythonx.y/package
>  
>
Installing in $prefix/lib/pythonx.y/site-packages/ only makes sense to me
when $prefix is one of the prefixes in site.prefixes, because those are the
only prefixes that python knows to load modules from.

There is one specific case when it is useful to install in
$prefix/lib/vtkx.y/python, and that is when you want to install multiple 
versions
of VTK in the same prefix without collisions.

>The alternative is 
>
> python setup.py install --home=$pth
>
>In which case the files are installed in 
>
> $pth/lib/python/package
> $pth/bin
>
>So, that is the default behavior of distutils.  What are you
>suggesting?
>  
>
I'm suggesting that we provide the user with options.  Also, the options
should not be marked as "advanced" options in cmake, they should be
clearly visible.

The option would be called VTK_PYTHON_USE_DISTUTILS, it would
be ON by default.

If VTK_PYTHON_USE_DISTUTILS is ON, the option VTK_PYTHON_SETUP_ARGS
will be present and will not be "advanced".  If ${CMAKE_PREFIX} is one 
of the prefixes
in site.prefixes, then it will be the default prefix.  This means that if
CMAKE_PREFIX=/usr/local and /usr/local is in site.prefixes, everything works
"out-of-the-box" after installation.  If ${CMAKE_PREFIX} is not in 
site.prefix,
then the default prefix will be sys.prefix.  That will make things will 
work nicely
for all superuser installs. 

If VTK_PYTHON_USE_DISTUTILS is OFF, then the modules will not be installed
by distutils, but will instead be put in ${CMAKE_PREFIX}/lib/vtkx.y/.
There would be a CMake option PYTHON_INSTALL_PATH to allow the user to
specify a different directory for installation.  Ideally VTK would 
produce a shell
script that the user could source to set the PYTHONPATH and LD_LIBRARY_PATH.

That should cover all the bases.  What do you think?

 - David
 - David



More information about the vtk-developers mailing list