[vtkusers] Installation vtk 5.2.0 on OS X and PYTHONPATH

Eric E. Monson emonson at cs.duke.edu
Mon Oct 6 10:02:58 EDT 2008


Hey Dave,

I don't have a good explanation (just through my ignorance), but the  
problem seems to be how you are importing the VTK modules in your  
script, not in the VTK installation.

When I run the script that you supplied in an earlier thread, I get  
the same error you do, but if I change the import statements to the  
standard "import vtk" (and add vtk. before the vtk classes, after  
which you shouldn't need to do that PYTHONPATH export), then it runs  
just fine on my machine, including printing out the number of polys.

Here's the modified script -- good luck.
-Eric

-------------- next part --------------
A non-text attachment was scrubbed...
Name: med1_numpoly_rev.py
Type: text/x-python-script
Size: 1983 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081006/e6d508dc/attachment.bin>
-------------- next part --------------



On Oct 5, 2008, at 10:52 AM, Dave Reed wrote:

>
> Sorry for the delay - took me a while to get to this. Installed the  
> enthought distribution. When running its Python, and typing: import  
> libvtkCommonPython, it claimed it couldn't find the module. I  
> exported PYTHONPATH to point it to enthought's copy of those files  
> and then it worked, but it still claims the GetNumberOfPolys method  
> doesn't exist for a vtkPolyData object.
>
> Dave
>
>
> On Sep 19, 2008, at 11:50 AM, Eric E. Monson wrote:
>
>> Hey Antoine,
>>
>> I always get that error you originally got during "sudo make  
>> install" of VTK, but for me it always works to just go into the  
>> build/Wrapping/Python directory and run "sudo python setup.py  
>> install". This has worked for me with the Python that ships with  
>> Leopard, as well as others. (For the Leopard python, by default it  
>> installs into /Library/Python/2.5/site-packages, which is fine.)
>>
>> Dave: If you're still having trouble getting VTK 5.0 to install  
>> correctly with the Python wrappings, you might want to consider  
>> downloading the Academic version of the Enthought Python  
>> distribution -- It will install its own version of Python (which  
>> you might not want), but it comes with a BUNCH of packages,  
>> including VTK 5.0.4.
>>
>> -Eric
>>
>> ------------------------------------------------------
>> Eric E Monson
>> Duke Visualization Technology Group
>>
>>
>> On Sep 19, 2008, at 11:18 AM, Antoine Dechaume wrote:
>>
>>> I tested the vtk 5.0.4 compilation and installation : it went ok.  
>>> Then I installed macpython 2.5.2 and compiled again vtk 5.2., and  
>>> finally the installation went ok as well.
>>> It seems the apple leopard python could be the culprit.
>>>
>>> Antoine.
>>>
>>> On 18-Sep-08, at 11:58 AM, davelist at mac.com wrote:
>>>
>>>>
>>>> I am also having issues related to getting Python on VTK working  
>>>> on OS X.
>>>>
>>>> Unless you installed Python yourself, I don't think /usr/local/ 
>>>> lib/python2.5/site-packages exists so you would need to create  
>>>> that directory using the mkdir command. Creating that directory  
>>>> and then updating PYTHONPATH and DYLD_LIBRARY_PATH allows the  
>>>> install to complete. VTK then partially works. Unfortunately,  
>>>> some of the Python VTK classes are missing some of the methods  
>>>> they should have so it doesn't completely work. I exchanged a  
>>>> bunch of emails with Mathieu off-list and it appears there are no  
>>>> errors in the installation, but something isn't working correctly  
>>>> on OS X. See my post back on September 9th with the subject  
>>>> "changes from 4.x to 5.x".
>>>>
>>>> I've also tried installing it with Linux, but I'm getting the  
>>>> same errors with missing methods so something is not always  
>>>> working correctly with the Python bindings. I still have 4.x  
>>>> installed on both so it's possible I'm getting some interaction  
>>>> between 4.x and 5.x libraries/binding files, but I tried to move  
>>>> them so they wouldn't show up in a path.
>>>>
>>>> At this point, I'm at a lost to completely solve the problem. If  
>>>> creating the directory allows the install to work for you, I'd  
>>>> love to know if you can run the sample script I have that fails.  
>>>> I'll be happy to send it to you if you get it to install - let me  
>>>> know.
>>>>
>>>> Thanks,
>>>> Dave
>>>>
>>>>
>>>> On Sep 18, 2008, at 1:25 PM, Antoine Dechaume wrote:
>>>>
>>>>> Thank you Dan but setting LD_LIBRARY_PATH or DYLD_LIBRARY_PATH  
>>>>> does not change anything unfortunately.
>>>>>
>>>>>
>>>>> On 18-Sep-08, at 10:24 AM, Dan White wrote:
>>>>>
>>>>>> Hi Antoine
>>>>>>
>>>>>> sometimes you might need to set
>>>>>> LD_LIBRARY_PATH
>>>>>> to point at the vtkWhateverPythonD.so
>>>>>> I just had to do that on ubuntu linux 64 bit with vtk 5.2
>>>>>> and have had to do it on OSX in the past also.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Begin forwarded message:
>>>>>>
>>>>>>> Message: 2
>>>>>>> Date: Wed, 17 Sep 2008 11:05:18 -0600
>>>>>>> From: Antoine Dechaume <boolegue at gmail.com>
>>>>>>> Subject: [vtkusers] Installation vtk 5.2.0 on OS X and  
>>>>>>> PYTHONPATH
>>>>>>> To: vtkusers <vtkusers at vtk.org>
>>>>>>> Message-ID: <ADBF0097-C07E-4D83-AE7A-F82DC5E6CA79 at gmail.com>
>>>>>>> Content-Type: text/plain; charset="us-ascii"; Format="flowed";
>>>>>>> 	DelSp="yes"
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I compiled and tested successfully vtk 5.2.0 on OS X 10.5  
>>>>>>> intel, with
>>>>>>> python wrapping on.
>>>>>>> At installation step, I got the following problem
>>>>>>>
>>>>>>> running cd "/Users/tonio/Downloads/Science/VTK/build/Wrapping/ 
>>>>>>> Python"
>>>>>>> && /usr/bin/python2.5 setup.py install --prefix="/usr/local"   
>>>>>>> 2>&1
>>>>>>> running install
>>>>>>> Checking .pth file support in /usr/local/lib/python2.5/site- 
>>>>>>> packages/
>>>>>>> /System/Library/Frameworks/Python.framework/Versions/2.5/ 
>>>>>>> Resources/
>>>>>>> Python.app/Contents/MacOS/Python -E -c pass
>>>>>>> TEST FAILED: /usr/local/lib/python2.5/site-packages/ does NOT
>>>>>>> support .pth files
>>>>>>> error: bad install directory or PYTHONPATH
>>>>>>>
>>>>>>> You are attempting to install a package to a directory that is  
>>>>>>> not
>>>>>>> on PYTHONPATH and which Python does not read ".pth" files  
>>>>>>> from.  The
>>>>>>> installation directory you specified (via --install-dir, -- 
>>>>>>> prefix, or
>>>>>>> the distutils default setting) was:
>>>>>>>
>>>>>>> /usr/local/lib/python2.5/site-packages/
>>>>>>>
>>>>>>> and your PYTHONPATH environment variable currently contains:
>>>>>>>
>>>>>>> ''
>>>>>>>
>>>>>>> Here are some of your options for correcting the problem:
>>>>>>>
>>>>>>> * You can choose a different installation directory, i.e., one  
>>>>>>> that is
>>>>>>> on PYTHONPATH or supports .pth files
>>>>>>>
>>>>>>> * You can add the installation directory to the PYTHONPATH  
>>>>>>> environment
>>>>>>> variable.  (It must then also be on PYTHONPATH whenever you run
>>>>>>> Python and want to use the package(s) you are installing.)
>>>>>>>
>>>>>>> * You can set up the installation directory to support ".pth"  
>>>>>>> files by
>>>>>>> using one of the approaches described here:
>>>>>>>
>>>>>>> http://peak.telecommunity.com/EasyInstall.html#custom-installation-locations
>>>>>>>
>>>>>>> Please make the appropriate changes for your system and try  
>>>>>>> again.
>>>>>>>
>>>>>>>
>>>>>>> But I do have PYTHONPATH=/usr/local/lib/python2.5/site- 
>>>>>>> packages !!!
>>>>>>>
>>>>>>> Thanks for any help.
>>>>>>>
>>>>>>> Antoine.
>>>>>>
>>>>>> Dr. Daniel James White BSc. (Hons.) PhD
>>>>>> Senior Microscopist / Image Processing and Analysis
>>>>>> Light Microscopy Facility
>>>>>> Max Planck Institute of Molecular Cell Biology and Genetics
>>>>>> Pfotenhauerstrasse 108
>>>>>> 01307 DRESDEN
>>>>>> Germany
>>>>>>
>>>>>>
>>>>>> New Mobile Number!!!
>>>>>>
>>>>>> +49 (0)15114966933 (German Mobile)
>>>>>> +49  (0)351 210 2627 (Work phone at MPI-CBG)
>>>>>> +49  (0)351 210 1078 (Fax MPI-CBG LMF)
>>>>>>
>>>>>> http://www.bioimagexd.net
>>>>>> http://www.chalkie.org.uk
>>>>>> dan at chalkie.org.uk
>>>>>> ( white at mpi-cbg.de )
>>>>>>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list