[Paraview] python scripting

Chukwudi Chukwudozie cchukw1 at tigers.lsu.edu
Fri Mar 22 10:55:23 EDT 2013


I just realized that paraview is using a different python (2.5) on my
system than the default one (2.7) which has numpy. Also, the paraview I got
is a compiled binary of 3.14. How do I go about pointing paraview to
python2.7.

Also, form running the saved trace using python, it looks like it cannot
load some of the paraview modules even though I can see them in the
paraview directory. Any help?

Regards

On Fri, Mar 22, 2013 at 12:17 AM, Chukwudi Chukwudozie <
cchukw1 at tigers.lsu.edu> wrote:

> Hi,
>
> So I got python2.7 working and I set all the variables correctly like you
> advised but I still get errors. When I try to run a saved trace using
> python, I get the following errors.
>
> b8-8d-12-38-84-40:Python chukwudichukwudozie$ python trace.py
> Traceback (most recent call last):
>   File "trace.py", line 2, in <module>
>     except: from paraview.simple import *
>   File "/Applications/ParaView.app/Contents/Python/paraview/simple.py",
> line 39, in <module>
>     import servermanager
>   File
> "/Applications/ParaView.app/Contents/Python/paraview/servermanager.py",
> line 43, in <module>
>     import paraview, re, os, os.path, new, sys, vtk
>   File
> "/Applications/ParaView.app/Contents/Python/paraview/vtk/__init__.py", line
> 1, in <module>
>     from vtkCommonPython import *
> ImportError:
> dlopen(/Applications/ParaView.app/Contents/Libraries/vtkCommonPython.so,
> 2): Library not loaded:
> @executable_path/../Libraries/libvtkCommonPythonD.pv3.14.dylib
>   Referenced from:
> /Applications/ParaView.app/Contents/Libraries/vtkCommonPython.so
>   Reason: image not found
>
> Also, when I try to use pvpython to run a simple script to plot graph, I
> get the error message below
>
> b8-8d-12-38-84-40:Python chukwudichukwudozie$ pvpython plot.py
> Traceback (most recent call last):
>   File "plot.py", line 2, in <module>
>     import numpy as np
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/__init__.py",
> line 130, in <module>
>     import add_newdocs
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/add_newdocs.py",
> line 9, in <module>
>     from lib import add_newdoc
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/lib/__init__.py",
> line 152, in <module>
>     from type_check import *
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/lib/type_check.py",
> line 8, in <module>
>     import numpy.core.numeric as _nx
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/core/__init__.py",
> line 5, in <module>
>     import multiarray
> ImportError:
> dlopen(/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/core/multiarray.so,
> 2): no suitable image found.  Did find:
> /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/numpy/core/multiarray.so:
> mach-o, but wrong architecture
>
>
> Thanks.
>
>
> On Sun, Mar 17, 2013 at 6:43 PM, Pat Marion <pat.marion at kitware.com>wrote:
>
>> For PYTHONPATH, try removing the last /paraview components from the path,
>> so you're setting:   /Applications/ParaView.app/Contents/Python
>>
>> Also add /Applications/ParaView.app/Contents/Libraries to PYTHONPATH and
>> DYLD_LIBRARY_PATH.  Note, that is DYLD not LD.  You don't need to add the
>> Contents/bin directory to DYLD_LIBRARY_PATH, and you don't need to add
>> DYLD_LIBRARY_PATH to PATH, and you don't need to add PYTHONPATH to PATH.
>>
>>
>> In summary, ParaView uses both pure python modules and c extension
>> modules.  The pure python modules are in Contents/Python, and the c
>> extension modules are in Contents/Libraries.  Both these paths should be on
>> PYTHONPATH (or append sys.path at the top of your main script).  The c
>> extenion modules have dependencies on dynamic libraries which are located
>> in Contents/Libraries, so Contents/Libraries this needs to be in the
>> DYLD_LIBRARY_PATH.
>>
>> Pat
>>
>>
>> On Sat, Mar 16, 2013 at 12:58 PM, Chukwudi Chukwudozie <
>> cchukw1 at tigers.lsu.edu> wrote:
>>
>>> Hi,
>>>
>>> I want help to be able to do the following two things using my mac OS X
>>> 10.7.5 but I have not been successful.
>>>
>>> 1. Run a paraview python script on terminal using pvpython.
>>> 2. Run the same script on terminal using python.
>>>
>>> For (1) above, I saved the trace for a particular operation and ran it
>>> using pvpython and it worked. However, I got a paraview python scripts
>>> (newscript.py) on the internet and when I try to run them on my terminal
>>> using pvpython, it aborts with the error below.
>>>
>>> Traceback (most recent call last):
>>>   File "newscript.py", line 3, in <module>
>>>     Connect()
>>>   File
>>> "/Applications/ParaView.app/Contents/Python/paraview/servermanager.py",
>>> line 1932, in Connect
>>>     connection = Connection(id, session)
>>>   File
>>> "/Applications/ParaView.app/Contents/Python/paraview/servermanager.py",
>>> line 1806, in __init__
>>>     raise RuntimeError, "Concurrent connections not supported!"
>>> RuntimeError: Concurrent connections not supported!
>>>
>>>
>>> For (2) above, I tried to run on my terminal using system python, the
>>> saved trace (newparaview.py) that was successful with pvpython and it keeps
>>> aborting with the following error messages
>>>
>>> Traceback (most recent call last):
>>>   File "newparaview.py", line 2, in <module>
>>>     from paraview.servermanager import *
>>> ImportError: No module named paraview.servermanager
>>>
>>> My .bash_profile file looks like this.
>>>
>>> export LD_LIBRARY_PATH=/Applications/ParaView.app/Contents/bin
>>> export PATH=$PATH:${LD_LIBRARY_PATH}
>>>
>>> export
>>> PYTHONPATH=$PYTHONPATH:/Applications/ParaView.app/Contents/Python/paraview:/Applications/ParaView.app/Contents/bin
>>> export PATH=$PATH:{$PYTHONPATH}
>>>
>>> # Setting PATH for EPD_free-7.2-2
>>> # The orginal version is saved in .bash_profile.pysave
>>> PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
>>> export PATH
>>>
>>>
>>> Regards,
>>>
>>>
>>> --
>>> Chukwudi Chukwudozie
>>> cchukw1 at tigers.lsu.edu
>>> Craft and Hawkins Department of Petroleum Engineering
>>> Louisiana State University
>>> Patrick F. Taylor Hall (CEBA)
>>> Room 3429
>>> Baton Rouge LA, 70803
>>> Cell:3373546822
>>> Office: 2255786064
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the ParaView Wiki at:
>>> http://paraview.org/Wiki/ParaView
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.paraview.org/mailman/listinfo/paraview
>>>
>>>
>>
>
>
> --
> Chukwudi Chukwudozie
> cchukw1 at tigers.lsu.edu
> Craft and Hawkins Department of Petroleum Engineering
> Louisiana State University
> Patrick F. Taylor Hall (CEBA)
> Room 3429
> Baton Rouge LA, 70803
> Cell:3373546822
> Office: 2255786064
>



-- 
Chukwudi Chukwudozie
cchukw1 at tigers.lsu.edu
Craft and Hawkins Department of Petroleum Engineering
Louisiana State University
Patrick F. Taylor Hall (CEBA)
Room 3429
Baton Rouge LA, 70803
Cell:3373546822
Office: 2255786064
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130322/a2a608b0/attachment.htm>


More information about the ParaView mailing list