different behaviour between ipython and python shell for importing paraview

232 views Asked by At

I'm trying to use paraview (http://www.paraview.org/) with python scripting in IPython.

When I'm trying to use it in a python shell it works just find but when I'm trying in IPython I've got the following error:

>>> import paraview.simple
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/gaspard/OpenFOAM/ThirdParty-2.2.2/platforms/linux64Gcc/paraview-3.12.0/lib/paraview-3.12/site-packages/paraview/simple.py", line 39, in <module>
import servermanager
File "/home/gaspard/OpenFOAM/ThirdParty-2.2.2/platforms/linux64Gcc/paraview-3.12.0/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
import paraview, re, os, os.path, new, sys, vtk
File "/home/gaspard/OpenFOAM/ThirdParty-2.2.2/platforms/linux64Gcc/paraview-3.12.0/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
from vtkCommonPython import *
ImportError: libvtkCommonPythonD.so.pv3.12: cannot open shared object file: No such file or directory
>>> 

The command I used were:

import sys
sys.path.append('/home/gaspard/OpenFOAM/ThirdParty-2.2.2/build/linux64Gcc/paraview-3.12.0/bin/')
sys.path.append('/home/gaspard/OpenFOAM/ThirdParty-2.2.2/platforms/linux64Gcc/paraview-3.12.0/lib/paraview-3.12/site-packages/')
import paraview.simple

Do you know why I've got a different behavior between the classic python shell and the IPython console? And how I can fix this?

1

There are 1 answers

1
Utkarsh On

You'll also need to set the LD_LIBRARY_PATH environment variable to point to the directory /home/gaspard/OpenFOAM/ThirdParty-2.2.2/platforms/linux64Gcc/paraview-3.12.0/lib/paraview-3.12/.