cpbotha.net

voices in my head

cpbotha.net random header image

Python 2.5 enabled VTK 5.2 Windows binaries

September 23rd, 2008 · 17 Comments · Uncategorized

You can always check my Latest VTK Windows binaries page to make sure you have the latest blog posting and hence the latest binaries.

I’ve made available my home-baked VTK 5.2 Windows binaries.  These have my special python-exception-patches integrated and have been built with Visual Studio 2005 (8.0) SP1 on Windows XP2 with full Python 2.5 support.  Get the binaries (or my patched source) by going here.  You want the binaries if you want to use VTK from Python.

IMPORTANT: you might have to install the MS VS2005 vcredist_x86 package (free!) if you want to use these DLLs (thanks Jelle for pointing this out).  This might not be necessary if you already have one or more of the MS development environments installed.

Please leave a comment on this blog posting if you use these or just hate them. It’s almost like postcard-ware, but with blog comments. Please also link to this page and not directly to the download location, thanks!

To use this from Python, you need to add the following to your PATH:

  • d:\opt\VTK\bin

You also need to add all of the above to PYTHONPATH, as well as the following:

  • d:\opt\VTK\lib\site-packages

… where d:\opt is the drive and directory where you unpacked the ZIP file.
Once you’ve done this and logged out and in again, “import vtk” should work at the Python prompt. Shameless plug: you can use my free envedit software to do the environment editing. It beats the default XP editing thingy.

Tags:

17 Comments so far ↓

  • Lukas Batteau

    Great work. I’ve finally managed to build everything from source and get it working myself, but this is really handy!

  • Scott

    awesome. thank you.

  • Nam Nguyen

    Hi,
    This is very helpful. Can you explain step by step about how to add PATH like:
    =======================================
    To use this from Python, you need to add the following to your PATH:

    * d:\opt\VTK\bin

    You also need to add all of the above to PYTHONPATH, as well as the following:

    * d:\opt\VTK\lib\site-packages
    =======================================

    Thanks a lot.

  • Guigounet

    Hi!

    First of all, I am to thank you for your vtk dll’s. I have been trying to compile and build from source with MinGw first, Cygwin secondly, and Cmake for 2 days but I fail to achieve vtk wrapping python installation on my XP os. So thank’s again.

    However, I want to create a tk widget to render into and pack it in a python Pmw GUI. But there is a dll missing, vtkRenderingPythonTkWidgets.dll, to instanciate it.
    Any help please?

    Best regards.

    Guy

  • Andrej Varchola

    Thank you, it is very useful.

  • Marten

    Thanks a lot! Works very well with Python 2.5.2!

  • Rafael Goncalves

    I’ve to thank you for these binaries. It was impossible to compile with g++ here. That said, I’m having some problems here, look:

    Traceback (most recent call last):
    File “”, line 1, in
    import vtk
    File “C:\vtk\lib\site-packages\vtk\__init__.py”, line 41, in
    from common import *
    File “C:\vtk\lib\site-packages\vtk\common.py”, line 9, in
    from vtkCommonPython import *
    ImportError: DLL load failed: Module not found.

    Since tha PATH and the PYTHONPATH are already ok, what should I do?

  • cpbotha

    @Rafael Goncalves:

    Your PATH should contain C:\vtk\bin and your PYTHONPATH should contain *both* c:\vtk\bin;c:\vtk\lib\site-packages

    Is this the case?

    Are you also sure that you have the vcredist package installed?

  • Cookie

    Hi cpbotha,
    It’s very good that these packages run well under python25! You are great! But when I cake sth. with itk3.8 package and then build in vs2005, there is an error like this:

    2>Cannot find SWIG Lib directory. Checked:
    2> C:/build/jwd/archive/Insight/Utilities/CableSwig/SWIG/Lib

    I checked the itk package, and found in the fiel “gdcmConfigure.h” there is a line

    #define PUB_DICT_PATH “C:/build/jwd/inst/Insight/share/gdcm/”

    and in the file “vcl_where_root_dir.h”
    #define VCL_SOURCE_ROOT_DIR “C:/build/jwd/archive/Insight/Utilities/vxl”

    I wish to know are there any other files influencing the later cmaking vcproj file. And do you have any other better ideas than change by hand?

  • Rafael Goncalves

    Yes, thats the case.

    Lukas:
    How did you manage to compile it? I’ve tryed with mingcw and VS9 but it went wrong all the times.

  • Lukas

    @Rafael:

    I’ve compiled several versions of VTK without any problems in VS8 (2005). Are you using CMake?

  • Tatiana

    To Lukas:
    Have you tried to compile ITK in VS2005 using CMake? I have compiled ITK for general python environment. But when I setted ITK_USE_REVIEW and USE_WRAP_ITK to ON , there are several errors…

  • Daniel

    Hello,

    I followed your instructions and installed vcredist. the folder is included in the path:
    C:\Documents and Settings\gdc229>echo %PATH%
    …C:\gfortran\bin;C:\VTK-5
    .2-Py25-VS8sp1-cpbotha.net\VTK\bin

    C:\Documents and Settings\gdc229>echo %PYTHONPATH%
    C:\VTK-5.2-Py25-VS8sp1-cpbotha.net\VTK\bin;C:\VTK-5.2-Py25-VS8sp1-cpbotha.net\VTK
    \lib\site-packages

    import vtk works
    from vtkCommonPython import * -> No module named vtkCommonPython

    do you have any ideas? I’ve never come across any package as difficult to install as vtk.
    thank you very much for providing this prebuild package, I already tried many times to build it, never worked for me.

  • Daniel

    Hi,

    another comment: even though I cannot run the examples under http://www.imaging.robarts.ca/~dgobbi/vtk/vtkpython.html
    mayavi works fine, this was my main goal.
    again, thank you very much for providing the library!

  • Brennan

    I’m trying this under Windows 2000 installed under Microsoft Virtual PC 2007. I tried “import vtk” from the python prompt but get an unable to find dll error as msvcr80.dll is missing. Unfortunately vcredist_x86.exe fails to install the dll’s as it comes up with a Windows Installer error due to another missing dll.

    Do you think I can simply copy over msvcr80.dll from XP?

  • Brennan

    msvcr80.dll from my XP installation didn’t work but I downloaded msvcr80.dll and msvcp80.dll from the http://www.dll-files.com website and that has got me a bit further along – still haven’t got a Mayavi/mlab app
    running properly yet but I did get a window flash up and then close so
    the missing dll errors have gone away.

  • cpbotha

    @Brennan:

    I’m glad that you managed to solve the DLL problem. You could try starting up MayaVi from a cmd window, hopefully you’ll see some more error output helping you to diagnose the problem.

Leave a Comment