Hi Miguel,
 non-system Python is a pain, but I guess you've already discovered it :-)

The latest issue you are having is related to the fact that VTK used by vmtk is 
not the official VTK, but it's a fork, 
differing from the official VTK just by two tiny commits. The commits are 
related to the Cocoa render window and
relatives (hence the error you are experiencing). Other than this, it closely 
follows the VTK release (not the master).

To get the "right" VTK do the following:

- move your VTK directory to a VTK-bkp directory
- clone my fork:
git clone git://github.com/lantiga/VTK.git
- move into the new VTK directory
cd VTK
- checkout the latest stable release branch
git checkout v5.10.0-vmtk
- now go back to VTK-build and just make (it shouldn't complain about the fact 
that you switched VTK under its nose,
but I can't be sure; if it does, just wipe VTK-build and rerun CMake and make)

Everything should compile fine at this point.


Related to your previous post:

> 1. The simpler one: installing binary packages and modifying my .bash_profile 
> by including "source /Applications/vmtk.app/Contents/MacOS/vmtk". 
>     - After doing so I type in ipython: from vmtk import vtkvmtk and I get 
> this error: Fatal Python error: Interpreter not initialized (version 
> mismatch?)
>     - I assume that the reason for this error is that the binary packages 
> have been compiled with a different python version


That is the issue. You can still make this work by commenting out 
Macports-related entries in your .bash_profile, but this means that you'll have 
to work
with system python


> 2. So I tried the difficult one: to compile VMTK from source. After following 
> the "Installing from source" procedure, and using the CMake default values 
> everything goes fine and VMTK is built. I then modify my .bash_profile 
> accordingly and:
>    - After doing so I type in ipython: from vmtk import vtkvmtk and get the 
> exact same error I got previously: Fatal Python error: Interpreter not 
> initialized (version mismatch?)
> 
> It seems that again the wrong python version has been used during building. 
> So I checked the CMakeCache.txt file in the VTK-build subdirectory and found 
> this configuration for python:
> PYTHON_EXECUTABLE:FILEPATH=/opt/local/bin/python2.7
> PYTHON_INCLUDE_DIR:PATH=/Library/Frameworks/Python.framework/Headers
> PYTHON_LIBRARY:FILEPATH=/opt/local/lib/libpython2.7.dylib
> 
> I think the problem is that PYTHON_INCLUDE_DIR is set to the headers dir of 
> the python version that already comes with Mac OS X. Actually the correct 
> PYTHON_INCLUDE_DIR should be 
> /opt/local/Library/Frameworks/Python.framework/Headers.
> 
> Since this directory is set automatically during installation, how can I 
> correct this problem? How can I compile/install VMTK correctly using my 
> python version?


I'm actually not entirely sure that PYTHON_INCLUDE_DIR, while wrong, is the 
culprit of the problem, since if the headers are the same and the linker 
doesn't complain about missing stuff during
compilation, it probably means that VTK should have linked to the right dylib, 
but the nice thing is that you can actually find out using the following 
command line

otool -L libvtkvmtkSegmentationPythonD.dylib 

where libvtkvmtkSegmentationPythonD.dylib is any of the dylibs in 
vmtk-build/Install/lib/vmtk/...

This way you can check if any of your dylib's is actually linked to the system 
Python.

In any case, to solve any doubt, you can actually manually edit the 
PYTHON_INCLUDE_DIR in CMakeCache.txt and make again, your new setting should be 
preserved.


Best,


Luca



On Jun 29, 2012, at 9:10 AM, Miguel Sotaquira wrote:

> Hi again,
> 
> I tried also this workaround:
> - Compiled ITK and VTK first (VTK including python support) using my version 
> of python (2.7.3)
> - Configured VMTK using ccmake ../VMTK_source_dir and set USE_SYSTEM_ITK, 
> USE_SYSTEM_VTK both to ON, and then set VTK_DIR and ITK_DIR accordingly.
> - Then make on Terminal and I get this error:
> 
> Linking CXX shared library ../../bin/libvtkvmtkCommon.dylib
> Undefined symbols for architecture x86_64:
>   "_OBJC_IVAR_$_vtkCocoaServer.renWin", referenced from:
>       -[vtkCocoaServer(vtkvmtkCocoaServer) close] in vtkvmtkCocoaServer.mm.o
>       -[vtkCocoaServer(vtkvmtkCocoaServer) start] in vtkvmtkCocoaServer.mm.o
>   "_OBJC_CLASS_$_vtkCocoaServer", referenced from:
>       l_OBJC_$_CATEGORY_vtkCocoaServer_$_vtkvmtkCocoaServer in 
> vtkvmtkCocoaServer.mm.o
>       objc-class-ref in vtkvmtkCocoaServer.mm.o
>   "_OBJC_CLASS_$_vtkCocoaGLView", referenced from:
>       l_OBJC_$_CATEGORY_vtkCocoaGLView_$_vtkvmtkCocoaGLView in 
> vtkvmtkCocoaGLView.mm.o
>       objc-class-ref in vtkvmtkCocoaGLView.mm.o
> ld: symbol(s) not found for architecture x86_64
> collect2: ld returned 1 exit status
> make[5]: *** [bin/libvtkvmtkCommon.dylib] Error 1
> make[4]: *** [vtkVmtk/Common/CMakeFiles/vtkvmtkCommon.dir/all] Error 2
> make[3]: *** [all] Error 2
> make[2]: *** [Stamp/VMTK/VMTK-build] Error 2
> make[1]: *** [CMakeFiles/VMTK.dir/all] Error 2
> make: *** [all] Error 2
> 
> I don't know what that means!
> 
> Thanks for any suggestion,
> Miguel
> 
> On Fri, Jun 29, 2012 at 7:26 AM, Miguel Sotaquira <msotaqu...@gmail.com> 
> wrote:
> Hi Luca,
> 
> I want to use some of the vmtk python scripts and libraries to implement my 
> own application. Basically from python (or ipython) I want to be able to do 
> "import vtkvmtk". My configuration is:
> - Mac OS X 10.6.8
> - Python 2.7.3 (installed via Macports)
> 
> In order to use vmtk I've tried several approaches:
> 
> 1. The simpler one: installing binary packages and modifying my .bash_profile 
> by including "source /Applications/vmtk.app/Contents/MacOS/vmtk". 
>     - After doing so I type in ipython: from vmtk import vtkvmtk and I get 
> this error: Fatal Python error: Interpreter not initialized (version 
> mismatch?)
>     - I assume that the reason for this error is that the binary packages 
> have been compiled with a different python version
> 
> 2. So I tried the difficult one: to compile VMTK from source. After following 
> the "Installing from source" procedure, and using the CMake default values 
> everything goes fine and VMTK is built. I then modify my .bash_profile 
> accordingly and:
>    - After doing so I type in ipython: from vmtk import vtkvmtk and get the 
> exact same error I got previously: Fatal Python error: Interpreter not 
> initialized (version mismatch?)
> 
> It seems that again the wrong python version has been used during building. 
> So I checked the CMakeCache.txt file in the VTK-build subdirectory and found 
> this configuration for python:
> PYTHON_EXECUTABLE:FILEPATH=/opt/local/bin/python2.7
> PYTHON_INCLUDE_DIR:PATH=/Library/Frameworks/Python.framework/Headers
> PYTHON_LIBRARY:FILEPATH=/opt/local/lib/libpython2.7.dylib
> 
> I think the problem is that PYTHON_INCLUDE_DIR is set to the headers dir of 
> the python version that already comes with Mac OS X. Actually the correct 
> PYTHON_INCLUDE_DIR should be 
> /opt/local/Library/Frameworks/Python.framework/Headers.
> 
> Since this directory is set automatically during installation, how can I 
> correct this problem? How can I compile/install VMTK correctly using my 
> python version?
> 
> Thanks,
> Miguel 
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> vmtk-users mailing list
> vmtk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/vmtk-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
vmtk-users mailing list
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users

Reply via email to