[vtkusers] VTK Python Wrapping OSX 10.9

Laurent Chauvin lchauvin at bwh.harvard.edu
Tue Apr 29 18:19:26 EDT 2014


This is what I thought.

I think I will create an alias like 'python2.7.3' to avoid confusing the
system.

Thank you.
-Laurent


On Tue, Apr 29, 2014 at 6:16 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> The easiest way is to add an alias to your .bash_profile file,
> which is in your home directory:
>
> alias python=/path/to/python
>
>   David
>
>
> On Tue, Apr 29, 2014 at 4:09 PM, Laurent Chauvin
> <lchauvin at bwh.harvard.edu> wrote:
> > Thank you David and Michka.
> >
> > I just figure it out.
> > Indeed you are right Michka, when I call 'python' from the terminal, it
> > called the 2.7.5 from the system instead of the one VTK has been built
> with.
> >
> > I went to python 2.7.3 directory and used ./python (instead of just
> 'python'
> > command) and I got the 'No module named vtk', but then I added the path
> in
> > PYTHONPATH and it worked.
> >
> > Thank you very much for your help.
> >
> > Also, is it possible to replace the default 'python' command with the
> 2.7.3
> > version, so I don't have to go in the directory all the time ?
> >
> > Thank you.
> > -Laurent
> >
> >
> > On Tue, Apr 29, 2014 at 6:00 PM, Michka Popoff <michkapopoff at gmail.com>
> > wrote:
> >>
> >> Okay, I think the problem is the following.
> >> If you type python in the terminal, OS X's python 2.7.5 is launched.
> >> VTK for slicer was compiled against the shipped python 2.7.3 I suppose.
> >>
> >> So you try to run from a 2.7.5 python a VTK library which was build
> >> against 2.7.3. That won't work (that's the error you get).
> >> You can not mix the two.
> >>
> >>
> >> Le 29 avr. 2014 à 23:53, Laurent Chauvin a écrit :
> >>
> >> Hi Michka,
> >>
> >> Thank you for your answer.
> >>
> >> I would prefer not to use a binary version of VTK, more a compiled
> >> version.
> >>
> >> I, indeed, have multiple versions of python (2.7.5 installed with xcode,
> >> and 2.7.3 installed with Slicer).
> >> However, I don't compile any code, and I don't use cmake. I just do
> >> something like 'python script.py'.
> >>
> >> I tried in both terminal, and it worked in none of them, but it worked
> in
> >> Slicer python interpreter. I guess Slicer set proper environment
> variable,
> >> but I cannot figure it out which one I should set.
> >>
> >> -Laurent
> >>
> >>
> >>
> >>
> >>
> >> On Tue, Apr 29, 2014 at 5:49 PM, Michka Popoff <michkapopoff at gmail.com>
> >> wrote:
> >>>
> >>> Hi
> >>>
> >>> if you need an easy install way on OS X 10.9, you may try installing
> vtk
> >>> through homebrew.
> >>> There are formulas for VTK 5 and VTK 6 which contain the right options
> to
> >>> install on OS X.
> >>> (Installation goes with "brew install vtk --with python")
> >>>
> >>> You can also try my binaries, which are installable through homebrew
> >>> (https://github.com/iMichka/homebrew-MacVTKITKPythonBottles)
> >>> In this case you don't even have to compile VTK :)
> >>>
> >>> The error you get is often due to a python library mismatch. Cmake is
> >>> picking up the wrong libraries (the python lib does not correspond to
> the
> >>> python executable).
> >>> Do you have mutliple pythons installed ?
> >>> You can also check the python paths in cmake (especially the path of
> the
> >>> PYTHON_LIBRARY).
> >>>
> >>> Michka
> >>>
> >>> Le 29 avr. 2014 à 23:36, Laurent Chauvin a écrit :
> >>>
> >>> Hello VTK Users,
> >>>
> >>> I'm trying to run an example of VTK (the vtk Cube.py example) in python
> >>> on Mac OSX 10.9.
> >>> I have VTK 5.10.1 and python 2.7.5.
> >>>
> >>> I read this page:
> >>> http://www.vtk.org/Wiki/VTK/Tutorials/PythonEnvironmentSetup
> >>>
> >>> which solved the 'no module named vtk' error, but now, I got another
> >>> error:
> >>>
> >>> Fatal Python error: PyThreadState_Get: no current thread
> >>> Abort trap: 6
> >>>
> >>> I heard the VTK 5.10 is not compatible with OSX 10.9, but it was a
> while
> >>> ago (end of 2013).
> >>>
> >>> The example is working when I use the python interpreter in Slicer, so
> my
> >>> guess is this is an issue with the environment path, but I cannot
> figure it
> >>> out.
> >>>
> >>> Does anyone already ran vtk python examples in OSX 10.9 ?
> >>>
> >>> Thank you very much.
> >>> -Laurent
> >>>
> >>> --
> >>> Laurent Chauvin, MS
> >>> Surgical Navigation and Robotics Laboratory, Radiology Department
> >>> Brigham And Women's Hospital, Harvard Medical School
> >>> http://wiki.ncigt.org/index.php/User:Lchauvin
> >>>
> >>> The information in this e-mail is intended only for the person to whom
> it
> >>> is
> >>> addressed. If you believe this e-mail was sent to you in error and the
> >>> e-mail
> >>> contains patient information, please contact the Partners Compliance
> >>> HelpLine at
> >>> http://www.partners.org/complianceline . If the e-mail was sent to
> you in
> >>> error
> >>> but does not contain patient information, please contact the sender and
> >>> properly
> >>> dispose of the e-mail.
> >>
> >>
> >>
> >>
> >> --
> >> Laurent Chauvin, MS
> >> Surgical Navigation and Robotics Laboratory, Radiology Department
> >> Brigham And Women's Hospital, Harvard Medical School
> >> http://wiki.ncigt.org/index.php/User:Lchauvin
> >>
> >>
> >
> >
> >
> > --
> > Laurent Chauvin, MS
> > Surgical Navigation and Robotics Laboratory, Radiology Department
> > Brigham And Women's Hospital, Harvard Medical School
> > http://wiki.ncigt.org/index.php/User:Lchauvin
>



-- 
Laurent Chauvin, MS
Surgical Navigation and Robotics Laboratory, Radiology Department
Brigham And Women's Hospital, Harvard Medical School
http://wiki.ncigt.org/index.php/User:Lchauvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140429/cec477f3/attachment-0001.html>


More information about the vtkusers mailing list