[Insight-users] Python Wrappers - WinXP

Peter M. Bloomfield peter.bloomfield at camhpet.ca
Wed Oct 31 12:04:02 EDT 2012


Hi Brad,

I set the PATH and PYTHONPATH as follows
	set PATH=C:\CAMH\ITK\lib\ITK-4.2\Python
	set PYTHONPATH=C:\CAMH\ITK\lib\ITK-4.2\Python

which is where the .pyd files are. However, I still get the same error after issuing the following commands in python
	import itk
	image_type = itk.Image[itk.F, 3]

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkLazy.py", line 37, in __getattribute__
    itkBase.LoadModule(module, namespace)
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 95, in LoadModule
    LoadModule(dep, namespace)
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 95, in LoadModule
    LoadModule(dep, namespace)
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 95, in LoadModule
    LoadModule(dep, namespace)
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 95, in LoadModule
    LoadModule(dep, namespace)
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 103, in LoadModule
    if not swigModuleName in sys.modules: module = loader.load(swigModuleName)
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 214, in load
    return imp.load_module(name, fp, pathname, description)
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\ITKCommonPython.py", line 30, in <module>
    _ITKCommonPython = swig_import_helper()
  File "C:\CAMH\ITK\lib\ITK-4.2\Python\ITKCommonPython.py", line 26, in swig_import_helper
    _mod = imp.load_module('_ITKCommonPython', fp, pathname, description)
ImportError: DLL load failed: The specified module could not be found.

Is there anything else I need to add to my PATH or PYTHONPATH environment variables, or have I missed setting another 
environment variable?


Cheers

Peter

>>>On Wednesday, October 31, 2012 11:53:01 AM Bradley Lowekamp wrote:

There should be a bunch of pyd files in that directory. The pyd extension is used for python C libraries[1], and should be 
included in your path. There should be a pyd file for each ITK module. 


Brad




[1] http://docs.python.org/2/faq/windows.html#is-a-pyd-file-the-same-as-a-dll




On Oct 31, 2012, at 11:42 AM, Peter M. Bloomfield <peter.bloomfield at camhpet.ca> wrote:


Hi Matt,
 
Thanks for getting back to me. This is where I am a tad confused.
 
In the directories under 'C:\CAMH\ITK' there is only a single DLL in directory C:\CAMH\ITK\bin named ITKCommon-4.2.dll.
There are 76 files in directory C:\CAMH\ITK\lib with the extension .lib
 
The only file named _ITKCommonPython is in the directory C:\CAMH\ITK\lib\ITK-4.2\Python and has an extension .pyd.
 
Cheers
 
Peter
 
On Wednesday, October 31, 2012 03:20:22 PM Matt McCormick wrote:
> Hi Peter,
> 
> If using PYTHONPATH to specify the location of the .py files, PATH
> also needs to be set to specify the location of the DLL's.
> 
> HTH,
> Matt
> 
> On Wed, Oct 31, 2012 at 10:37 AM, Peter M. Bloomfield
> 
> <peter.bloomfield at camhpet.ca> wrote:
> > Hi,
> > 
> > 
> > 
> > I am experiencing a problem with python wrapping. I have the following on a
> > 32-bit WinXP machine
> > 
> > Visual Studio 9 2008
> > 
> > ITK V4.2.1
> > 
> > Python 2.7.2
> > 
> > 
> > 
> > I have selected 'ITK_WRAP_PYTHON' and 'BUILD_SHARED_LIBS' and set
> > 'CMAKE_INSTALL_PREFIX' to C:\CAMH\ITK within cmake, and all compiles and
> > installs without error in VS 2008.
> > 
> > 
> > 
> > I have set a PYTHONPATH to include both
> > 
> > C:\CAMH\ITK\lib\ITK-4.2\Python
> > 
> > C:\CAMH\ITK\lib
> > 
> > though I am not sure if I have these correct. I can import itk from within
> > python, but get an error when issuing the command
> > 
> > image_type = itk.Image[itk.F, 3]
> > 
> > as shown below.
> > 
> > 
> > 
> > Microsoft Windows XP [Version 5.1.2600]
> > 
> > (C) Copyright 1985-2001 Microsoft Corp.
> > 
> > 
> > 
> > C:\Documents and Settings\Peter>python
> > 
> > Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on
> > win32
> > 
> > Type "help", "copyright", "credits" or "license" for more information.
> > 
> >>>> import itk
> >>>> 
> >>>> image_type = itk.Image[itk.F, 3]
> > 
> > Traceback (most recent call last):
> > 
> > File "<stdin>", line 1, in <module>
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkLazy.py", line 37, in
> > __getattribute__
> > 
> > itkBase.LoadModule(module, namespace)
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 95, in LoadModule
> > 
> > LoadModule(dep, namespace)
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 95, in LoadModule
> > 
> > LoadModule(dep, namespace)
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 95, in LoadModule
> > 
> > LoadModule(dep, namespace)
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 95, in LoadModule
> > 
> > LoadModule(dep, namespace)
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 103, in LoadModule
> > 
> > if not swigModuleName in sys.modules: module = loader.load(swigModuleName)
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\itkBase.py", line 214, in load
> > 
> > return imp.load_module(name, fp, pathname, description)
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\ITKCommonPython.py", line 30, in
> > <module>
> > 
> > _ITKCommonPython = swig_import_helper()
> > 
> > File "C:\CAMH\ITK\lib\ITK-4.2\Python\ITKCommonPython.py", line 26, in
> > swig_import_helper
> > 
> > _mod = imp.load_module('_ITKCommonPython', fp, pathname, description)
> > 
> > ImportError: DLL load failed: The specified module could not be found.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Can anyone point me in the right direction to get the itk python wrapping
> > working,
> > 
> > 
> > 
> > Many thanks
> > 
> > 
> > 
> > Peter
> > 
> > 
> > 
> > 
> > 
> > 
> > _____________________________________
> > Powered by www.kitware.com
> > 
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> > 
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.php
> > 
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> > 
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
 
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121031/ce9db81e/attachment.htm>


More information about the Insight-users mailing list