[vtkusers] How to use built vtk with python

Eric E. Monson emonson at cs.duke.edu
Mon Apr 5 11:36:59 EDT 2010


Hey Jothy,

Did you ever get this working? To see if I could get it to work properly I built VTK on my Windows 7 64-bit machine with VS 2008 Pro, and also built the INSTALL solution which was set to install at c:\Program Files (x86)\VTK. (For the latter I had to run VS as Administrator to get the proper permissions.) I was able to do "import vtk" from the standard Python shell after I had my PATH and PYTHONPATH set up properly. 

In case it's helpful for you trying to track down your problem, here are the values from the environment variables on my system, along with the directory listings from the important directories that Python will look in. (I hope this helps you track down what's not right on your machine. Sorry it's a bit messy, but it's just a copy/paste from the command shell I was working in...)

-Eric

---------------------------------------------
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\emonson>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Wind
owsPowerShell\v1.0\;C:\Program Files (x86)\cvsnt;C:\Program Files (x86)\Tortoise
Hg\;C:\Users\emonson\Programming\qt-everywhere-opensource-src-4.6.2\lib;"C:\Prog
ram Files (x86)\CMake 2.8\bin";"C:\Program Files (x86)\cvsnt";C:\Python26;C:\Pro
gram Files (x86)\VTK\bin

C:\Users\emonson>echo %PYTHONPATH%
C:\Program Files (x86)\VTK\bin;C:\Program Files (x86)\VTK\lib\site-packages

C:\Users\emonson>python
Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> import sys
>>> sys.path
['', 'C:\\Program Files (x86)\\VTK\\bin', 'C:\\Program Files (x86)\\VTK\\lib\\si
te-packages', 'C:\\Windows\\system32\\python26.zip', 'C:\\Python26\\DLLs', 'C:\\
Python26\\lib', 'C:\\Python26\\lib\\plat-win', 'C:\\Python26\\lib\\lib-tk', 'C:\
\Python26', 'C:\\Python26\\lib\\site-packages']
>>> ^Z


C:\Users\emonson>cd "c:\Program Files (x86)"\VTK\bin

c:\Program Files (x86)\VTK\bin>dir
 Volume in drive C has no label.
 Volume Serial Number is A872-E9FC

 Directory of c:\Program Files (x86)\VTK\bin

04/05/2010  11:17 AM    <DIR>          .
04/05/2010  11:17 AM    <DIR>          ..
04/05/2010  10:31 AM            17,408 lproj.exe
04/05/2010  10:31 AM            49,664 MapReduceMPI.dll
04/05/2010  10:31 AM             9,216 mpistubs.dll
04/05/2010  10:58 AM           475,648 QVTK.dll
04/05/2010  10:31 AM           132,608 vtkalglib.dll
04/05/2010  10:57 AM           514,560 vtkCharts.dll
04/05/2010  11:05 AM           170,496 vtkChartsPythonD.dll
04/05/2010  10:34 AM         2,547,712 vtkCommon.dll
04/05/2010  10:37 AM         1,225,216 vtkCommonPythonD.dll
04/05/2010  10:29 AM           122,368 vtkDICOMParser.dll
04/05/2010  10:30 AM            18,944 vtkEncodeString.exe
04/05/2010  10:31 AM           264,192 vtkexoIIc.dll
04/05/2010  10:30 AM           128,512 vtkexpat.dll
04/05/2010  10:38 AM         3,024,384 vtkFiltering.dll
04/05/2010  10:42 AM         1,970,176 vtkFilteringPythonD.dll
04/05/2010  10:30 AM           459,264 vtkfreetype.dll
04/05/2010  10:31 AM            41,984 vtkftgl.dll
04/05/2010  10:44 AM           205,824 vtkGenericFiltering.dll
04/05/2010  10:57 AM           146,944 vtkGenericFilteringPythonD.dll
04/05/2010  10:57 AM           415,232 vtkGeovis.dll
04/05/2010  11:05 AM           209,408 vtkGeovisPythonD.dll
04/05/2010  10:44 AM         6,065,664 vtkGraphics.dll
04/05/2010  10:56 AM         2,465,792 vtkGraphicsPythonD.dll
04/05/2010  10:51 AM         2,616,832 vtkHybrid.dll
04/05/2010  11:01 AM         1,023,488 vtkHybridPythonD.dll
04/05/2010  10:40 AM         2,825,216 vtkImaging.dll
04/05/2010  10:44 AM           733,184 vtkImagingPythonD.dll
04/05/2010  10:56 AM         1,904,128 vtkInfovis.dll
04/05/2010  11:05 AM           743,936 vtkInfovisPythonD.dll
04/05/2010  10:42 AM         4,639,744 vtkIO.dll
04/05/2010  10:45 AM         1,058,816 vtkIOPythonD.dll
04/05/2010  10:29 AM           140,800 vtkjpeg.dll
04/05/2010  10:31 AM         1,281,536 vtklibxml2.dll
04/05/2010  10:30 AM           571,392 vtkmetaio.dll
04/05/2010  10:30 AM           177,152 vtkNetCDF.dll
04/05/2010  10:29 AM           125,440 vtkpng.dll
04/05/2010  10:31 AM           220,672 vtkproj4.dll
04/05/2010  10:58 AM           180,736 vtkpython.exe
04/05/2010  10:34 AM           679,936 vtkQtChart.dll
04/05/2010  10:50 AM         4,422,656 vtkRendering.dll
04/05/2010  11:00 AM         2,045,952 vtkRenderingPythonD.dll
04/05/2010  10:30 AM           250,368 vtksys.dll
04/05/2010  10:30 AM           315,904 vtktiff.dll
04/05/2010  10:30 AM           157,696 vtkverdict.dll
04/05/2010  10:57 AM           529,920 vtkViews.dll
04/05/2010  11:05 AM           346,112 vtkViewsPythonD.dll
04/05/2010  10:52 AM         2,746,368 vtkVolumeRendering.dll
04/05/2010  11:01 AM           388,096 vtkVolumeRenderingPythonD.dll
04/05/2010  10:54 AM         1,596,928 vtkWidgets.dll
04/05/2010  11:03 AM         1,270,784 vtkWidgetsPythonD.dll
04/05/2010  10:29 AM            80,896 vtkWrapPython.exe
04/05/2010  10:29 AM            10,240 vtkWrapPythonInit.exe
04/05/2010  10:29 AM            67,072 vtkzlib.dll
              53 File(s)     53,833,216 bytes
               2 Dir(s)  33,500,278,784 bytes free

C:\Users\emonson>cd "c:\Program Files (x86)\VTK\lib\site-packages"

c:\Program Files (x86)\VTK\lib\site-packages>dir
 Volume in drive C has no label.
 Volume Serial Number is A872-E9FC

 Directory of c:\Program Files (x86)\VTK\lib\site-packages

04/05/2010  11:17 AM    <DIR>          .
04/05/2010  11:17 AM    <DIR>          ..
04/05/2010  11:17 AM    <DIR>          vtk
04/05/2010  11:17 AM               258 VTK-5.7.0-py2.6.egg-info
               1 File(s)            258 bytes
               3 Dir(s)  33,498,316,800 bytes free

c:\Program Files (x86)\VTK\bin>cd "c:\Program Files (x86)\VTK\lib\site-packages\
vtk"

c:\Program Files (x86)\VTK\lib\site-packages\vtk>dir
 Volume in drive C has no label.
 Volume Serial Number is A872-E9FC

 Directory of c:\Program Files (x86)\VTK\lib\site-packages\vtk

04/05/2010  11:17 AM    <DIR>          .
04/05/2010  11:17 AM    <DIR>          ..
04/05/2010  11:06 AM               239 charts.py
04/05/2010  11:17 AM               424 charts.pyc
04/05/2010  11:06 AM               244 common.py
04/05/2010  11:17 AM               423 common.pyc
04/05/2010  11:06 AM               247 filtering.py
04/05/2010  11:17 AM               435 filtering.pyc
04/05/2010  11:06 AM               271 genericfiltering.py
04/05/2010  11:17 AM               464 genericfiltering.pyc
04/05/2010  11:06 AM               239 geovis.py
04/05/2010  11:17 AM               424 geovis.pyc
04/05/2010  11:06 AM               244 graphics.py
04/05/2010  11:17 AM               431 graphics.pyc
04/05/2010  11:17 AM    <DIR>          gtk
04/05/2010  11:06 AM               239 hybrid.py
04/05/2010  11:17 AM               424 hybrid.pyc
04/05/2010  11:06 AM               241 imaging.py
04/05/2010  11:17 AM               427 imaging.pyc
04/05/2010  11:06 AM               242 infovis.py
04/05/2010  11:17 AM               428 infovis.pyc
04/05/2010  11:06 AM               228 io.py
04/05/2010  11:17 AM               407 io.pyc
04/05/2010  11:06 AM               245 parallel.py
04/05/2010  11:17 AM               432 parallel.pyc
04/05/2010  11:17 AM    <DIR>          qt
04/05/2010  11:17 AM    <DIR>          qt4
04/05/2010  11:06 AM               248 rendering.py
04/05/2010  11:17 AM               436 rendering.pyc
04/05/2010  11:06 AM               199 required.py
04/05/2010  11:17 AM               353 required.pyc
04/05/2010  11:17 AM    <DIR>          test
04/05/2010  11:06 AM               258 textanalysis.py
04/05/2010  11:17 AM               449 textanalysis.pyc
04/05/2010  11:17 AM    <DIR>          tk
04/05/2010  11:17 AM    <DIR>          util
04/05/2010  11:06 AM               236 views.py
04/05/2010  11:17 AM               420 views.pyc
04/05/2010  11:06 AM               266 volumerendering.py
04/05/2010  11:17 AM               460 volumerendering.pyc
04/05/2010  11:05 AM            12,288 vtkChartsPython.pyd
04/05/2010  10:37 AM            40,960 vtkCommonPython.pyd
04/05/2010  10:42 AM            53,248 vtkFilteringPython.pyd
04/05/2010  10:57 AM             9,728 vtkGenericFilteringPython.pyd
04/05/2010  11:05 AM            13,312 vtkGeovisPython.pyd
04/05/2010  10:56 AM            59,904 vtkGraphicsPython.pyd
04/05/2010  11:01 AM            18,432 vtkHybridPython.pyd
04/05/2010  10:44 AM            29,696 vtkImagingPython.pyd
04/05/2010  11:05 AM            30,720 vtkInfovisPython.pyd
04/05/2010  10:45 AM            40,960 vtkIOPython.pyd
04/05/2010  11:00 AM            48,128 vtkRenderingPython.pyd
04/05/2010  11:05 AM            12,288 vtkViewsPython.pyd
04/05/2010  11:01 AM            18,432 vtkVolumeRenderingPython.pyd
04/05/2010  11:03 AM            29,696 vtkWidgetsPython.pyd
04/05/2010  11:06 AM               244 widgets.py
04/05/2010  11:17 AM               428 widgets.pyc
04/05/2010  11:17 AM    <DIR>          wx
04/05/2010  11:06 AM             1,019 __helper.py
04/05/2010  11:17 AM             1,515 __helper.pyc
04/05/2010  11:06 AM             3,771 __init__.py
04/05/2010  11:17 AM             2,465 __init__.pyc
              52 File(s)        437,957 bytes
               9 Dir(s)  33,498,316,800 bytes free

c:\Program Files (x86)\VTK\lib\site-packages\vtk>


More information about the vtkusers mailing list