[Insight-users] problem to wrap Itk with python

Luis Ibanez luis.ibanez@kitware.com
Thu May 13 21:54:36 EDT 2004


Hi Nick,


Your ITK build is certainly a mess  :-)


Please follow the "Perestroika" procedure:


A) Delete the entire binary directory
    where you were attempting to build ITK

B) Delete the entire binary directory
    where you built CableSwig.

C) Delete the directory where you have
    CableSwig sources.

D) Delete the directory where you have
    ITK sources.



Take deep breath.

It's time for renovation...


E) Download ITK sources through CVS
    The wrapping builds are green today
    in the Dashboard.

F) Go to the Utilities directory and
    download the CVS version of CableSwig
    in that directory.

    You should end up with something like

       Insight/Utilities/CableSwig


G) Make sure that you are using CMake 1.8.3


H) Configure ITK using CMake.

    *DO NOT* build in-source. (it seems that
    you were doing that in you current built).

    Select a binary directory different from
    the source directory.

    Make sure that you select the correct
    version of the compiler. This is done in
    the upper right menu of the CMake GUI.

    Then

    - Disable EXAMPLES
    - Disable TESTING
    - Enable  SHARED_LIBRARIES

    click Configure, and then click OK


I) Load the .sln project into VisualStudio.
    *VERY IMPORTANT*: verify that your visual
    studio do not think that the .txx files
    should be compiled !!. Some users have
    manually set that option in order to
    see the source files in their project,
    and cause havoc at compilation time.



J) Build this project. It should take about
    15 minutes.



If the build fails, please send us any
error messages that you get.





K) If the build goes ok, then Quit VisualStudio
    (close the project) and rerun CMake.

    Enable Python wrapping.

    Make sure that you select a consistent
    set of Python interpreter and libraries.
    E.g. you don't want to use the python
    libraries of windows, with the python
    interpreter of Cygwin.


L) Reload the project in VisualStudio


M) Build.


IF you get any build errors, please post them
to the list.


N) Set the PYTHONPATH variable according
    to the instruction in the README file

        Insight/Wrapping/CSwig/README


O) Try running any of the Python examples in



          Insight/Examples




----


If you get in trouble in any of those steps
please let us know up to what step you were
doing OK.



    Thanks



       Luis





---------------
Nick Hu wrote:

> Hi Luis,
> I rebuilt the itk with python and this time I got errors:
> "
> _ITKAlgorithmsPython error result returned from
> 'c:\project\itk\insighttoolkit-1.6.0\wrapping\cswig\algorithms\release\bat00
> 010e.bat'.
> _ITKBasicFiltersPython error result returned from
> 'c:\project\itk\insighttoolkit-1.6.0\wrapping\cswig\basicfilters\release\bat
> 00008d.bat'.
> _ITKCommonPython error result returned from
> 'c:\project\itk\insighttoolkit-1.6.0\wrapping\cswig\common\release\bat00002a
> .bat'.
> _ITKIOPython error result returned from
> 'c:\project\itk\insighttoolkit-1.6.0\wrapping\cswig\io\release\bat00014f.bat
> '.
> _ITKNumericsPython error result returned from
> 'c:\project\itk\insighttoolkit-1.6.0\wrapping\cswig\numerics\release\bat0000
> 84.bat'.
> _VXLNumericsPython error result returned from
> 'c:\project\itk\insighttoolkit-1.6.0\wrapping\cswig\vxlnumerics\release\bat0
> 00005.bat'.
> "
> and if I go to any sub_dir above I could find a log file which contains lots
> of errors. I attacted one to you so please take a look.
> 
> Actually I have been struggling with building process for 2 weeks. Sometimes
> if I built itk without Python first and built CSwig seperately, then re-ran
> Cmake to turn the Python wrapping on, I could built the whole project
> without errors, But _VXLNumericsPython.dll is not created. However if I had
> CSwig done first and ran Cmake for itk with python wrapping on, then I got
> errors and all the python modules like algorithm, IO... are not generated.
> 
> Both release 1.6 and nightly have same problems.This really puzzles  me a
> lot.
> 
> Thank you very much for your time.
> 
> Regards,
> 
> nick
> 
> ----- Original Message ----- 
> From: "Luis Ibanez" <luis.ibanez@kitware.com>
> To: "Nick Hu" <nhu@sten.sunnybrook.utoronto.ca>
> Cc: <Insight-users@itk.org>
> Sent: Wednesday, May 12, 2004 7:03 PM
> Subject: Re: [Insight-users] problem to wrap Itk with python
> 
> 
> 
>>
>>Hi Nick,
>>
>>
>>Did you got *any* error messages during the build ?
>>
>>--
>>
>>Please go to the directory:
>>
>>   ITK_BIN/Wrapping/CSwig/VXLNumerics
>>
>>find the file
>>
>>     _VXLNumericsPython.vcproj
>>
>>and send it to us in an attachemt.
>>
>>This is a text file. you can actually open it
>>with any text editor and look for the rule for
>>building
>>
>>
>>        _VXLNumericsPython.dll
>>
>>
>>
>>Regards,
>>
>>
>>    Luis
>>
>>
>>
>>
>>-----------------
>>Nick Hu wrote:
>>
>>
>>>Luis, see the answers below please:
>>>
>>>
>>>
>>>>What method are you using for setting
>>>>the PYTHONPATH environment variable ?
>>>
>>>
>>>>From "Start" menu on the desktop->"Setting"->"Control
>>>panel"->"system"-"advanced" tab->"environment Varaibles"-> "Edit"
> 
> PYTHONPATH
> 
>>>
>>>>What operating system are you running ?
>>>
>>>Windows 2000
>>>
>>>
>>>
>>>>What Python version are you using ?
>>>
>>>python 2.3
>>>
>>>
>>>
>>>
>>>>The file
>>>>
>>>>     VXLNumericsPython.py
>>>>
>>>>should be located on:
>>>>
>>>>        ITK_BIN/bin/release
>>>>
>>>>or
>>>>
>>>>        ITK_BIN/bin/debug
>>>>
>>>>depending on the compilation mode that
>>>>you used, and where ITK_BIN is the
>>>>binary directory where you built ITK.
>>>
>>>
>>>I can't find the file in the directory and no py file in the directory.
>>>
>>>
>>>
>>>>Did you build for Release ? or did you build
>>>>for Debug ?
>>>
>>>
>>>Release
>>>
>>>
>>>>Are you moving the files after building them  ?
>>>>You *should not* move the files after completing
>>>>the build process.
>>>
>>>
>>>No I didn't move files
>>>
>>>
>>>
>>>>---
>>>>
>>>>Just for the record:
>>>>
>>>>We build nightly ITK with Python wrapping under
>>>>Visual Studio 7 2003. You will find this built at
>>>>"terminus.kitware". There are 8 python test run
>>>>nightly.
>>>>
>>>
>>>I have the same problem with release 1.6 and nightly version. The file
>>>"VXLNumericsPython.py" just does not exist on my machine :(
>>>
>>>Regards,
>>>
>>>nick
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>-----------------
>>>>Nick Hu wrote:
>>>>
>>>>
>>>>
>>>>>Luis, Actually I read it and I did it.
>>>>>
>>>>>I already set the environment variable PYTHONPATH to the location, so
> 
> it
> 
>>>>>could load some modules like itkbase.py, itkAlogorithm.py ... but the
>>>
>>>error
>>>
>>>
>>>>>indicated that "VXLNumericsPython"  could not be found (it does not
>>>
>>>exist).
>>>
>>>
>>>>>The other thing I actually found in the
> 
> "Insight/Wrapping/CSwig/README"
> 
>>>is
>>>
>>>
>>>>>although you could copy Cswig to ../Utilities/ as part of itk, you
> 
> can't
> 
>>>>>just start building itk --it will complain that some cmake file can't
> 
> be
> 
>>>>>found. You will have to run cmake to configure Cswig and build it first
>>>
>>>and
>>>
>>>
>>>>>then start building itk.
>>>>>
>>>>>By the way I use visual studio 7 .net 2003.
>>>>>Any advice?
>>>>>Thanks a lot.
>>>>>
>>>>>nick
>>>>>----- Original Message ----- 
>>>>>From: "Luis Ibanez" <luis.ibanez@kitware.com>
>>>>>To: "Nick Hu" <nhu@sten.sunnybrook.utoronto.ca>
>>>>>Cc: <insight-users@itk.org>
>>>>>Sent: Wednesday, May 12, 2004 4:26 PM
>>>>>Subject: Re: [Insight-users] problem to wrap Itk with python
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Hi Nick,
>>>>>>
>>>>>>
>>>>>>Please read the README file in
>>>>>>
>>>>>>    Insight/Wrapping/CSwig/README
>>>>>>
>>>>>>
>>>>>>It seems that you are simply missing to
>>>>>>set up the evironment variable PYTHONPATH
>>>>>>
>>>>>>--
>>>>>>
>>>>>>First set the PYTHONPATH variable to
>>>>>>
>>>>>>  ITK-build/Wrapping/CSwig/Python/[Release].
>>>>>>
>>>>>>Then run python and run this python command:
>>>>>>
>>>>>>   from InsightToolkit import *
>>>>>>
>>>>>>
>>>>>>
>>>>>>Regards,
>>>>>>
>>>>>>
>>>>>>   Luis
>>>>>>
>>>>>>





More information about the Insight-users mailing list