CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

[OpenFOAM.org] paraview and python install problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 19, 2013, 22:31
Default paraview and python install problem
  #1
Member
 
laurentL
Join Date: Oct 2011
Location: new caledonia
Posts: 73
Rep Power: 15
laurent98 is on a distinguished road
hi all,
sorry for asking such a simple problem but i really face it since 2 days!
i want to run paraview in batch mode or just get a pic with a python script. and i am not a expert !!!

so i compile paraFoam with makeParaView setup
withPYTHON=true
PYTHON_LIBRARY="/usr/lib/libpython3.2mu.so.1.0"
# PYTHON_LIBRARY="/usr/lib64/libpython2.6.so.1.0"

# MESA graphics support:
withMESA=false
MESA_INCLUDE="/usr/include/GL"
MESA_LIBRARY="/usr/lib64/libOSMesa.so"

# extra QT gui support (useful for some third party apps)
withQT=true

# Set the path to the Qt-4.5 (or later) qmake if the system Qt is older
QMAKE_PATH=""

# Set the path to cmake
CMAKE_PATH=""

i add in the .bachrc file
export PYTHONPATH=$PYTHONPATH:/home/laurent/OpenFOAM/ThirdParty-2.2.0/build/linuxGcc/paraview-3.12.0/Utilities/VTKPythonWrapping/site-packages #fixes "no module named paraview"
export PYTHONPATH=$PYTHONPATH:/home/laurent/OpenFOAM/ThirdParty-2.2.0/platforms/linuxGcc/paraview-3.12.0/bin #fixes "ImportError: No module named libvtkCommonPython"

and when i run idle3 python i have this message.
Python 3.2.1 (default, Jul 18 2011, 16:24:40) [GCC] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> import paraview
>>> from paraview.simple import *
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from paraview.simple import *
File "/home/laurent/OpenFOAM/ThirdParty-2.2.0/build/linuxGcc/paraview-3.12.0/Utilities/VTKPythonWrapping/site-packages/paraview/simple.py", line 134
raise RuntimeError, "File not readable: %s " % first_file
^
SyntaxError: invalid syntax

any help will ve very welcome because i am going mad!!!
thank by advance LL
laurent98 is offline   Reply With Quote

Old   June 20, 2013, 16:54
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings laurent98,

I'm not sure if ParaView 3.12.0 can handle Python 3.2.

Any chance you can indicate which Linux Distribution you are using? This way I could try and reproduce the problem.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   June 20, 2013, 20:15
Default
  #3
Member
 
laurentL
Join Date: Oct 2011
Location: new caledonia
Posts: 73
Rep Power: 15
laurent98 is on a distinguished road
hi Bruno,
thanks a lot for your help.
i am using opensuse 12.1
i had try also with python 2.7 still not running but this different message came from idle interpretor;

Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> import paraview
>>> from paraview.simple import *

Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from paraview.simple import *
File "/home/laurent/OpenFOAM/ThirdParty-2.2.0/build/linuxGcc/paraview-3.12.0/Utilities/VTKPythonWrapping/site-packages/paraview/simple.py", line 40, in <module>
import servermanager
File "/home/laurent/OpenFOAM/ThirdParty-2.2.0/build/linuxGcc/paraview-3.12.0/Utilities/VTKPythonWrapping/site-packages/paraview/servermanager.py", line 43, in <module>
import paraview, re, os, os.path, new, sys, vtk
File "/home/laurent/OpenFOAM/ThirdParty-2.2.0/build/linuxGcc/paraview-3.12.0/Utilities/VTKPythonWrapping/site-packages/paraview/vtk/__init__.py", line 1, in <module>
from vtkCommonPython import *
ImportError: No module named vtkCommonPython
>>>

i really don t know what to do???
best regards LL
laurent98 is offline   Reply With Quote

Old   June 23, 2013, 07:46
Default
  #4
New Member
 
Christoph Kratzsch
Join Date: Nov 2011
Location: Freiberg
Posts: 28
Rep Power: 15
PonchO is on a distinguished road
Hi folks,

i have exactly the same problem. I have exported the paths as this page says: http://paraview.org/Wiki/ParaView/Py....simple_Module but it doesn't work.

My LD_LIBRARY_PATH links to the folder where the vtkCommonCorePython.so should be.
I mentioned if it is a 64Bit .so so i do a file-command.
This gives me:
Code:
file vtkCommonCorePython.so
vtkCommonCorePython.so: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b20cbc6de288730f94f5d4301cfc661ba9d2ac44, stripped
So it's 64Bit and should work on my system.

System Specifications:

Manjaro 0.8.6
python 2.7.5 and python 3.3.2
paraview 4.0.1
LD_LIBRARY_PATH: :/opt/opencascade/lib:/usr/lib/python2.7:/usr/lib
PYTHONPATH: :/usr/lib/python2.7/site-packages/:/usr/lib/paraview-4.0/site-packages/

I am using Python just for scripting and evaluation and plotting of my results, but i think this can be used more powerful, if i can couple paraview to that.
So laurent98, if you have found a solution to this, please share .

Best Regards,

Christoph
PonchO is offline   Reply With Quote

Old   June 23, 2013, 14:05
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

OK, to address first laurent98's problem, I've done the following steps in a virtual machine with openSUSE 12.1 64bit (x86_64). laurent98 has got 32bit, but I'll try to keep the instructions generic enough.

@Christoph: Try the instructions below, but only starting from the section for the python shell and beyond.



For installing, I followed the instructions from here: http://openfoamwiki.net/index.php/In...#openSUSE_12.2 - but I made some changes in the following steps:
  • In step #1, I also installed "python-devel":
    Code:
    zypper install python-devel
  • In step #7, I ran makeParaView like this:
    Code:
    ./makeParaView -python
    It detected Python 2.7 automatically, which is why I did not modify the makeParaView script.
  • Still on step #7, after makeParaView has finished running, run the following command:
    Code:
    cp $WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION/bin/vtk*.so $ParaView_DIR/lib/paraview-$ParaView_MAJOR/
Then to set-up the Python environment, I added the following lines in "~/.bashrc", after the line for OpenFOAM that ends with bashrc:
Code:
source /home/user/OpenFOAM/OpenFOAM-2.2.0/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI


#added these lines

export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/site-packages
export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/lib/paraview-3.12/site-packages

Start a new shell terminal. Then run python:
Code:
python

Now, within the python shell, run:
Code:
import paraview
import vtk
from paraview.simple import *

And that's it!


Now, there is one important detail: pvpython is the advised application for interacting with Python + ParaView. To run it, simply run:
Code:
pvpython

Best regards,Bruno
__________________
wyldckat is offline   Reply With Quote

Old   June 23, 2013, 14:31
Default
  #6
New Member
 
Christoph Kratzsch
Join Date: Nov 2011
Location: Freiberg
Posts: 28
Rep Power: 15
PonchO is on a distinguished road
Hi Bruno,

thank you for your quick reply.

Unfortunately it still doesn't work .

Same error as before:

As you said i start with:
Code:
import paraview
import vtk
from paraview.simple import *
But then as always:

Code:
Error: Could not import vtkCommonComputationalGeometryPython
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-7-fd18706122a4> in <module>()
----> 1 from paraview.simple import *

/usr/lib/paraview-4.0/site-packages/paraview/simple.py in <module>()
     39 paraview.compatibility.major = 3
     40 paraview.compatibility.minor = 5
---> 41 import servermanager
     42 
     43 #==============================================================================

/usr/lib/paraview-4.0/site-packages/paraview/servermanager.py in <module>()
     46 #
     47 #==============================================================================
---> 48 import paraview, re, os, os.path, new, sys, atexit, vtk
     49 
     50 if not paraview.compatibility.major:

/usr/lib/paraview-4.0/site-packages/paraview/vtk/__init__.py in <module>()
      5 except ImportError:
      6     paraview.print_error("Error: Could not import vtkCommonComputationalGeometryPython")
----> 7 from vtkCommonCorePython import *
      8 from vtkCommonDataModelPython import *
      9 from vtkCommonExecutionModelPython import *

ImportError: No module named vtkCommonCorePython
Now i recognize, that there is a problem besides the vtkCommonCorePython regarding the vtkCommonComputationalGeometryPython at the top of the error-message.

Do you have an idea? Should i start from scratch and compile paraview by myself?

Best regards,

Christoph
PonchO is offline   Reply With Quote

Old   June 23, 2013, 14:33
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Christoph,

Without knowing which Linux Distribution you're using and how you installed ParaView, it's very complicated to figure out what the solution is.

Nonetheless, as I indicated in the last few lines of the previous post, pvpython is advised for interacting with ParaView.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   June 23, 2013, 15:52
Default
  #8
New Member
 
Christoph Kratzsch
Join Date: Nov 2011
Location: Freiberg
Posts: 28
Rep Power: 15
PonchO is on a distinguished road
I'm using an ArchLinux-based distro called Manjaro. So i access the Arch User Repository in which the paraview package is. A tool compiles the whole Paraview.

I think i will start compiling it by myself and then go to the next step with pvpython.

Thanks up to this point. I will report if i've found a solution.

Best regards,

Christoph
PonchO is offline   Reply With Quote

Old   June 26, 2013, 18:12
Default
  #9
Member
 
laurentL
Join Date: Oct 2011
Location: new caledonia
Posts: 73
Rep Power: 15
laurent98 is on a distinguished road
hi Bruno,
thank you very much for your help, it is very nice of you. i made some progress in the installation. it seems that python -devel qt4-x11-tools ... was missing.
i still have some problemes;
after makeparaview -python the tail of terminal log is;

...
/home/laurent/OpenFOAM/ThirdParty-2.2.0/ParaView-3.12.0/VTK/Wrapping/Python/vtkPythonArgs.cxx:117:28: error: ‘PyInt_AsLong’ was not declared in this scope
make[2]: *** [VTK/Wrapping/Python/CMakeFiles/vtkPythonCore.dir/vtkPythonArgs.cxx.o] Error 1
make[1]: *** [VTK/Wrapping/Python/CMakeFiles/vtkPythonCore.dir/all] Error 2
make: *** [all] Error 2
---
Installation complete for paraview-3.12.0
Set environment variables:

export ParaView_DIR=/home/laurent/OpenFOAM/ThirdParty-2.2.0/platforms/linuxGcc/paraview-3.12.0
export PATH=$ParaView_DIR/bin:$PATH
export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-3.12
---

Done

looks like there is a problem with vtk because there is no files vtk*.so here the message after the cp comand;

linux-juf1:/home/laurent/OpenFOAM/ThirdParty-2.2.0 # cp $WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION/bin/vtk*.so $ParaView_DIR/lib/paraview-$ParaView_MAJOR/
cp: cannot stat `/home/laurent/OpenFOAM/ThirdParty-2.2.0/build/linuxGcc/paraview-3.12.0/bin/vtk*.so': No such file or directory

i have look inside the directory$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION/bin/ there is some libvtk*.so or others *vtk*.so but nothink like vtk*.so ???

finally in the python interpreter i get;
>>> from QVTKPython import *
RuntimeError: the sip module implements API v8.0 to v8.1 but the vtk.QVTKPython module requires API v10.0
>>>

in which direction should i go???
thanks you again, best regards LL
laurent98 is offline   Reply With Quote

Old   June 27, 2013, 18:28
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Laurent,

I think I know what the problem is. You probably have the two python versions installed: 2.7 and 3.2. But the makeParaView script is having trouble figuring out which Python version should be used.

If I'm not mistaken, it's possibly picking up the python application version 3.2 and the include folder only exists for 2.7. But first, confirm if the following command gives you anything:
Code:
ls -l /usr/include/python2.7
It should show you the contents of the folder that makeParaView needs and that should have been provided by the "python-devel" package.

Then check which Python version it is picking up, by running:
Code:
python --version
If it gives you 3.2.x, then this is the big problem, because the wrong version is being picked up, because you need 2.7 to be picked up.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   June 28, 2013, 12:25
Default
  #11
Member
 
laurentL
Join Date: Oct 2011
Location: new caledonia
Posts: 73
Rep Power: 15
laurent98 is on a distinguished road
P { margin-bottom: 0.21cm; } Dear Bruno,
thanks you SO much! It is great, very nice of you to help people as you are doing!
You were perfectly right, the problem came from the 2 versions installed of python. So, before to makeParaview I just put in the makeparaview files;


withPYTHON=true
PYTHON_LIBRARY="/usr/lib/libpython2.7.so.1.0"


now ,
laurent@linux-juf1:~> pvpython
Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paraview
>>> from paraview.simple import *
paraview version 3.12.0, Date: 2011-07-26
>>>


run ok
still import vtk have this problem


>>> import vtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/vtk/__init__.py", line 127, in <module>
from qvtk import *
File "/usr/lib/python2.7/site-packages/vtk/qvtk.py", line 8, in <module>
from QVTKPython import *
RuntimeError: the sip module implements API v8.0 to v8.1 but the vtk.QVTKPython module requires API v10.0
>>>


but I don't know if it is important, I have to play now with python script to do what I went!
hope this can help others person, thanks again to Bruno!
best regards LL
laurent98 is offline   Reply With Quote

Old   February 6, 2014, 10:13
Default
  #12
New Member
 
Luca Franceschini
Join Date: Aug 2012
Posts: 29
Rep Power: 14
Luchini is on a distinguished road
Hi,

i have some problems on this too.

First makeParaView does not recognize my python, so i did:

Code:
withPYTHON=true
PYTHON_LIBRARY="/usr/lib/libpython2.7.so.1.0"
When run makeParaView at the end i had this error:

Code:
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers: 
Cannot open data base file /home/flucci/OpenFOAM/ThirdParty-2.2.x/build/linux64Gcc/paraview-3.12.0/Documentation/paraview.qch!
make[2]: *** [Documentation/paraview.qch] Error 255
make[1]: *** [Documentation/CMakeFiles/ParaViewOnlineHelp.dir/all] Error 2
make: *** [all] Error 2
    ---
    Installation complete for paraview-3.12.0
    Set environment variables:

        export ParaView_DIR=/home/flucci/OpenFOAM/ThirdParty-2.2.x/platforms/linux64Gcc/paraview-3.12.0
        export PATH=$ParaView_DIR/bin:$PATH
        export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-3.12
    ---

Done
but since it was on the documentation i moved on.
I tried to update the PYTHONPATH but both :/usr/lib/python2.7/ and :$ParaView_DIR/lib/paraview-3.12/ do not have the site-packages subdirectories.


Moreover if i do :

Code:
import paraview
import vtk
from paraview.simple import *
I get:

Code:
:~/OpenFOAM/ThirdParty-2.2.x$ python
Python 2.7.3 (default, Sep 26 2013, 20:03:06) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paraview
>>> import vtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/vtk/__init__.py", line 41, in <module>
    from vtkCommonPython import *
ImportError: /home/flucci/Programs/visit/2.6.2/linux-x86_64/lib/libvtkPythonCore.so.5.8: undefined symbol: PyUnicodeUCS2_DecodeUTF8
>>> from paraview.simple import *
Segmentation fault (core dumped)
Does anybody knows what went wrong?



few more inputs:
i use Ubuntu,
OF 2.2.X

if i run pvpython i also have :
Code:
:~/OpenFOAM/ThirdParty-2.2.x$ pvpython
Error converting executable file "/usr/bin/../lib/paraview/pvpython" to real path: No such file or directory

THANK YOU A LOT
Luchini is offline   Reply With Quote

Old   February 6, 2014, 18:00
Default
  #13
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Luca,

Can you specify which version of Ubuntu you are using, so that I can try and replicate the same problem?

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 7, 2014, 04:33
Default
  #14
New Member
 
Luca Franceschini
Join Date: Aug 2012
Posts: 29
Rep Power: 14
Luchini is on a distinguished road
Hi Bruno,

Thank you a lot ( again) for your help.

I have the 12.04 LTS.

If this procedure is too long is it possible to link paraFoam to a later paraview installtion?
(i have an executable of the paraview 4.1 already with the python included..)

thank you a lot
Luchini is offline   Reply With Quote

Old   February 15, 2014, 11:53
Default
  #15
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Luca,

Sorry for the late reply. I had a better, yet quick read, of the two posts you've written and the diagnosis is that VisIt is getting in the way. You should make sure that you start with a clean shell environment and then activate only OpenFOAM's shell environment. Then proceed on to building ParaView.
If you're not familiar with the shell environment, have a look into this wiki page: http://openfoamwiki.net/index.php/In...with_the_Shell

If after using a clean shell environment, without interference from VisIt, you still have problems, let us know!

As for using a pre-built ParaView 4.1.0:

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 12, 2014, 20:33
Default
  #16
New Member
 
luigi
Join Date: May 2014
Posts: 1
Rep Power: 0
luigi412 is on a distinguished road
Dear all;
Thank for your previous post. I am still not able to use the "Python Shell" in paraview.
Unfortunatly I still have this error when I try to start trace:
>>> from paraview.simple import *
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/servermanager.py", line 43, in <module>
import paraview, re, os, os.path, new, sys, vtk
File "/opt/paraviewopenfoam3120/lib/paraview-3.12/site-packages/paraview/vtk/__init__.py", line 1, in <module>
from vtkCommonPython import *
ImportError: No module named vtkCommonPython

I am using ubuntu 12.04 with OF 2.2.1 and paraview 3.12.0 It seems like vtkCommonPython is not existing on my pc.
Do you have any idea how to solve my problem?
thank you very much!
Luigi
luigi412 is offline   Reply With Quote

Old   December 13, 2014, 16:12
Default
  #17
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Luigi and welcome to posting on the forum!

The error message you're seeing looks familiar to me... have a look at this bug report, which has a solution for this: http://www.openfoam.org/mantisbt/view.php?id=969
More specifically, this solution: http://www.cfd-online.com/Forums/ope...tml#post446490 post #17

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM.org] ParaView Installation: Python problem KateEisenhower OpenFOAM Installation 5 August 24, 2017 06:27
[General] Determining number of cores and/or paraview executable via python aerogt3 ParaView 0 December 9, 2014 06:54
[OpenFOAM] paraview v4 - building with python - OF2.3.0, PVv4, Python 2.7 aylalisa ParaView 4 June 13, 2014 09:52
How to get Python Shell into ParaView 3.8.1? blaise OpenFOAM Installation 3 July 24, 2012 05:58
ParaView installation problem on Suse 11.4 victorz OpenFOAM Installation 4 February 6, 2012 18:26


All times are GMT -4. The time now is 18:08.