[Paraview] ParaView Python console with scipy

Felipe Bordeu felipe.bordeu at ec-nantes.fr
Mon Dec 9 10:43:44 EST 2013


Hello,

I'm trying to make my python script work with scipy but I'm unable make 
it work. I tried :

the Paraview 4.0.1(pvpyton from the web)  in linux (64 ubuntu 12.04)   
with the scipy of my system (/usr/lib/python2.7/dist-packages )  and I get :

...
Traceback (most recent call last):
   File "build.py", line 17, in <module>
     from scipy import optimize
   File "/usr/lib/python2.7/dist-packages/scipy/__init__.py", line 78, 
in <module>
     from numpy import show_config as show_numpy_config
   File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 137, 
in <module>
     import add_newdocs
   File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 9, 
in <module>
     from numpy.lib import add_newdoc
   File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 
4, in <module>
     from type_check import *
   File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 
8, in <module>
     import numpy.core.numeric as _nx
   File "/usr/lib/python2.7/dist-packages/numpy/core/__init__.py", line 
5, in <module>
     import multiarray
ImportError: /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so: 
undefined symbol: PyUnicodeUCS4_AsUnicodeEscapeString
..

then I tried the opposite, system python and import Paraview modules and 
I get :

...
   File "/home/fbordeu/Dropbox/chady/Aerolia/FunLib.py", line 46, in 
__init__
     self.KCOND = PXDMFReader( guiName='Kcond Vademecum ' + 
str(self.ID), FileName=self.Kcond );
   File 
"/apps/ParaView-4.0.1-Linux-64bit/lib/paraview-4.0/site-packages/paraview/simple.py", 
line 1145, in CreateObject
     setattr(px, param, params[param])
   File 
"/apps/ParaView-4.0.1-Linux-64bit/lib/paraview-4.0/site-packages/paraview/servermanager.py", 
line 254, in __setattr__
     setter(self, value)
   File 
"/apps/ParaView-4.0.1-Linux-64bit/lib/paraview-4.0/site-packages/paraview/servermanager.py", 
line 2477, in setProperty
     return self.SetPropertyWithName(propName, value)
   File 
"/apps/ParaView-4.0.1-Linux-64bit/lib/paraview-4.0/site-packages/paraview/servermanager.py", 
line 309, in SetPropertyWithName
     prop.SetData(arg)
   File 
"/apps/ParaView-4.0.1-Linux-64bit/lib/paraview-4.0/site-packages/paraview/servermanager.py", 
line 730, in SetData
     self.SMProperty.SetElement(idx, self.ConvertValue(val))
TypeError: SetElement argument 2: (unicode conversion error)

...

I search in the internet for the error, and is because the ParaView 
python and the system python are compiled with the same flags... mmm.

So I tried the same thing in my mac (10.8.5)  with ParaView from web.  :

Paraview Python with system scipy (binary from http://www.scipy.org):

...
Traceback (most recent call last):
   File "build.py", line 17, in <module>
     from scipy import optimize
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/optimize/__init__.py", 
line 148, in <module>
     from ._root import *
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/optimize/_root.py", 
line 20, in <module>
     from . import nonlin
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/optimize/nonlin.py", 
line 122, in <module>
     import scipy.sparse.linalg
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/__init__.py", 
line 206, in <module>
     from .csr import *
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/csr.py", 
line 15, in <module>
     from .sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/__init__.py", 
line 5, in <module>
     from .csr import *
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/csr.py", 
line 26, in <module>
     _csr = swig_import_helper()
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/csr.py", 
line 22, in swig_import_helper
     _mod = imp.load_module('_csr', fp, pathname, description)
ImportError: 
dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/_csr.so, 
2): Symbol not found: _PyCapsule_GetPointer
   Referenced from: 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/_csr.so
   Expected in: flat namespace
  in 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/sparsetools/_csr.so
...


and finally system python (mac) with ParView modules :

...
/Applications/ParaViewfromWeb/Paraview4.0.1.app/Contents/Python/numpy/random/__init__.py:87: 
RuntimeWarning: compiletime version 2.6 of module 'mtrand' does not 
match runtime version 2.7
   from mtrand import *
Fatal Python error: Interpreter not initialized (version mismatch?)
...


Does any one was able to work with Scipy and Paraview (from the web). 
I'm writing some code that will execute in ParaView downloaded from the web.


Thanks
Felipe


-- 
Felipe Bordeu Weldt
Ingénieur de Recherche
-------------------------------------
Tél. : 33 (0)2 40 37 16 57
Fax. : 33 (0)2 40 74 74 06
Felipe.Bordeu at ec-nantes.fr
Institut GeM - UMR CNRS 6183
École Centrale Nantes
1 Rue de La Noë, 44321 Nantes, FRANCE
-------------------------------------



More information about the ParaView mailing list