[vtkusers] using VTK 5.6 through Python 2.6 on windows

David Gobbi david.gobbi at gmail.com
Mon Nov 1 23:57:09 EDT 2010


Hi Prathamesh,

The PYTHONPATH method and the site_packages method are mutually
exclusive.  You should not use both of these methods at the same time.

I usually recommend to people that before they move any files, they
set the PYTHONPATH to make sure that everything works in-place.  Then,
if they want to make the installation more permanent, they can move
the files to site_packages.  After you have moved things to
site_packages, you should clear the PYTHONPATH.

For myself, I always just use PYTHONPATH and I never move any files.

  David


On Mon, Nov 1, 2010 at 9:34 PM, Prathamesh Kulkarni
<prathameshmkulkarni at gmail.com> wrote:
>
> So, from what you said, I get the following steps for using VTK in Python:
> 1. Set
> the PYTHONPATH=C:/VTK/VTK_BIN_DIR/Wrapping/Python;C:/VTK/VTK_BIN_DIR/bin/Debug
> 2. Copy all vtkxxPython.pyd files from xx/vtk/bin to
> xx/vtk/Wrapping/Python/vtk
> 3. Copy the xx/vtk/Wrapping/Python/vtk to Pythonxx/../site_packages/vtk
> Is this the correct way ?
> - Prathamesh
>
> On Mon, Nov 1, 2010 at 10:06 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> The vtkxxxPythonD.dlls must not be renamed to .pyd.  Those are not
>> python modules.  They are DLLs that the python modules (like
>> vtkCommonPython.pyd) need.
>>
>> If you built VTK correctly, you should already have
>> vtkCommonPython.pyd without having to rename any files.  All of the
>> file renaming that you have done is incorrect, none of these files
>> should ever be renamed.
>>
>>  David
>>
>>
>>
>> On Mon, Nov 1, 2010 at 8:36 PM, Prathamesh Kulkarni
>> <prathameshmkulkarni at gmail.com> wrote:
>> > I have set the PYTHONPATH as mentioned below.
>> > Now, I did the following:
>> > 1. Copied all the vtkxxPythonD.dll to the 'vtk' directory.
>> > 2. Renamed these with the extension *.pyd.
>> > 3. Copied this 'vtk' directory to site_packages of Python2.6
>> > 4. Got an error 'ImportError: No module named vtkCommonPython'
>> > 5. Renamed all the vtkxxPythonD.pyd files to vtkxxPython.pyd
>> > After this, so far, import vtk works.
>> > Could you please explain me whether what I did is formal and correct way
>> > of
>> > using vtk in Python and why?
>> > Thanks,
>> > Prathamesh
>> > On Mon, Nov 1, 2010 at 9:12 PM, David Gobbi <david.gobbi at gmail.com>
>> > wrote:
>> >>
>> >> Hi Prathamesh,
>> >>
>> >> The vtk "module" is the vtk directory in Wrapping\Python.  It, in
>> >> turn, requires all the the Python.pyd files in the bin\Debug directory
>> >> (or just bin if you are using mingw or cygwin to compile).
>> >>
>> >> SET
>> >>
>> >> PYTHONPATH=C:/VTK/VTK_BIN_DIR/Wrapping/Python;C:/VTK/VTK_BIN_DIR/bin/Debug
>> >>
>> >> If you made a VTK directory in site_packages, get rid of it until you
>> >> have everything working with PYTHONPATH.
>> >>
>> >> David
>> >>
>> >>
>> >> On Mon, Nov 1, 2010 at 8:05 PM, Prathamesh Kulkarni
>> >> <prathameshmkulkarni at gmail.com> wrote:
>> >> > Hello all,
>> >> > I want to be able to use VTK in Python. I have installed VTK with
>> >> > BUILD_SHARD_LIBS and WRAP_PYTHON. Then I build VTK in debug mode.
>> >> > I get a lot of files in C:\VTK\VTK_BIN_DIR\Wrapping\Python. I tried
>> >> > to
>> >> > do
>> >> > many things with this:
>> >> > 1. Create a new environment variable called PYTHONPATH and add the
>> >> > above
>> >> > path there
>> >> > 2. copy everything in that path to a new directory called VTK inside
>> >> > site_packages
>> >> > None of this seems to work and I cannot do a 'import vtk'. I keep
>> >> > getting
>> >> > the error: 'ImportError: No module named VTK'
>> >> > Please point me out to a formal way of helping python 'see' vtk
>> >> > Thanks,
>> >> > Prathamesh
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > Powered by www.kitware.com
>> >> >
>> >> > Visit other Kitware open-source projects at
>> >> > http://www.kitware.com/opensource/opensource.html
>> >> >
>> >> > Please keep messages on-topic and check the VTK FAQ at:
>> >> > http://www.vtk.org/Wiki/VTK_FAQ
>> >> >
>> >> > Follow this link to subscribe/unsubscribe:
>> >> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >> >
>> >> >
>> >
>> >
>
>



More information about the vtkusers mailing list