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

[PyFoam] Problems using pyFoamPVLoadState.py

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 6, 2010, 06:08
Default Problems using pyFoamPVLoadState.py
  #1
New Member
 
Fabian
Join Date: Jan 2010
Posts: 27
Rep Power: 16
gautcho is on a distinguished road
Hello everybody,

I do my first steps with pyFoam and it works out very well so long, but now i try to use some state-files of paraview using

"pyFoamPVLoadState.py --state==teststate.pvsm cavity"

The result is an error message:

"
Traceback (most recent call last):
File "/usr/local/bin/pyFoamPVLoadState.py", line 3, in <module>
from PyFoam.Applications.PVLoadState import PVLoadState
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/PVLoadState.py", line 11, in <module>
from PyFoam.Paraview.ServermanagerWrapper import ServermanagerWrapper as SM
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Paraview/__init__.py", line 15, in <module>
from paraview import servermanager
ImportError: No module named paraview
"

Paraview 3.6.1 is installed, so what does this error mean and how can I avoid it...
gautcho is offline   Reply With Quote

Old   July 6, 2010, 10:27
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gautcho View Post
Hello everybody,

I do my first steps with pyFoam and it works out very well so long, but now i try to use some state-files of paraview using

"pyFoamPVLoadState.py --state==teststate.pvsm cavity"

The result is an error message:

"
Traceback (most recent call last):
File "/usr/local/bin/pyFoamPVLoadState.py", line 3, in <module>
from PyFoam.Applications.PVLoadState import PVLoadState
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/PVLoadState.py", line 11, in <module>
from PyFoam.Paraview.ServermanagerWrapper import ServermanagerWrapper as SM
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Paraview/__init__.py", line 15, in <module>
from paraview import servermanager
ImportError: No module named paraview
"

Paraview 3.6.1 is installed, so what does this error mean and how can I avoid it...
I'm afraid it is a Paraview without Python support (check if there is an entry "Python Shell" in the "Tools" menu. If it isn't there, then you habve no Python-support)

Bernhard
gschaider is offline   Reply With Quote

Old   July 13, 2010, 10:55
Default
  #3
New Member
 
Fabian
Join Date: Jan 2010
Posts: 27
Rep Power: 16
gautcho is on a distinguished road
Thanks, I think, you got it.

Do you know any tutorial or anything like this describing how to activate the python support???

Regrads
gautcho is offline   Reply With Quote

Old   July 14, 2010, 03:00
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gautcho View Post
Thanks, I think, you got it.

Do you know any tutorial or anything like this describing how to activate the python support???

Regrads
I'm afraid you'll have to recompile paraview. The makeParaview-script in the ThirdParty-folder provides a switch -python that enables Python-support. Have a look at the messages in the beginning whether it finds the system-Python. If not you'll have to set the PYTHON_SOMETHING-variable in that script. Be aware that due to changes in the API for loading Plugins there might be problems with loading the PV3Reader in 3.6 (native reader should be OK). If I remember it correctly PVLaodState works, PVSnapshot does not.

Bernhard
gschaider is offline   Reply With Quote

Old   September 22, 2010, 06:05
Default
  #5
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 14
alfa_8C is an unknown quantity at this point
Hello Gautcho,

I have currently the same problem and I tried to switch all the SET(ENABLE_PYTHON = OFF) to SET(ENABLE_PYTHON = ON) stuff into several files within the ThirdParty directory. But after recompiling they are all set again to OFF!! There must be an other "switch" to manipulate. Did you find out how to do it? I took just a look into the makeParaviw script, but I couldn't make clearly out any option to switch ON or OFF the PYTHON support...

Thanx in advance for any input,
Antonio
alfa_8C is offline   Reply With Quote

Old   September 22, 2010, 09:43
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alfa_8C View Post
Hello Gautcho,

I have currently the same problem and I tried to switch all the SET(ENABLE_PYTHON = OFF) to SET(ENABLE_PYTHON = ON) stuff into several files within the ThirdParty directory. But after recompiling they are all set again to OFF!! There must be an other "switch" to manipulate. Did you find out how to do it? I took just a look into the makeParaviw script, but I couldn't make clearly out any option to switch ON or OFF the PYTHON support...

Thanx in advance for any input,
Antonio
You mean "recompiling with the makeParaview-script". That one generates the configuration anew. But it has a -python-option that configures Paraview with Python. Otherwise don't edit the fles by hand, but use ccmake

Bernhard
gschaider is offline   Reply With Quote

Old   September 22, 2010, 10:29
Default
  #7
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 14
alfa_8C is an unknown quantity at this point
Hello Bernhard,

yes exactly I mean the makeParaView Script..

I want to install Paraview with Python support in order to be able to use your contribution, and I'm following this hin on OpenFoamWiki:

http://openfoamwiki.net/index.php/Us...s/Installation

This is how it looks like within my makeParaView script after modifying it:

# Python support:
# note: script will try to determine the appropriate python library.
# If it fails, specify the path using the PYTHON_LIBRARY variable
withPYTHON=true
#PYTHON_LIBRARY=""
PYTHON_LIBRARY="/usr/lib/libpython2.6.so.1.0"
PYTHON_INCLUDE="/usr/include/python2.6"

According to the OpenFoamWiki I changed also the File: $WM_PROJECT_INST_DIR/ThirdParty-1.6.x/tools/makeParaViewFunctions.

When I run then the makeParaView script again, it starts quite well until this step:

Scanning dependencies of target vtkWrapPython
Scanning dependencies of target vtkWrapPythonInit
[ 0%] [ 0%] Building C object VTK/Wrapping/CMakeFiles/vtkWrapPython.dir/vtkWrapPython.c.o
Building C object VTK/Wrapping/CMakeFiles/vtkWrapPythonInit.dir/vtkWrapPythonInit.c.o

After this step it breaks up saying: this file not found
that file not found
the other file not found

what am I doing wrong??? Any Idea??
alfa_8C is offline   Reply With Quote

Old   September 22, 2010, 12:40
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alfa_8C View Post
Hello Bernhard,

yes exactly I mean the makeParaView Script..

I want to install Paraview with Python support in order to be able to use your contribution, and I'm following this hin on OpenFoamWiki:

http://openfoamwiki.net/index.php/Us...s/Installation

This is how it looks like within my makeParaView script after modifying it:

# Python support:
# note: script will try to determine the appropriate python library.
# If it fails, specify the path using the PYTHON_LIBRARY variable
withPYTHON=true
#PYTHON_LIBRARY=""
PYTHON_LIBRARY="/usr/lib/libpython2.6.so.1.0"
PYTHON_INCLUDE="/usr/include/python2.6"

According to the OpenFoamWiki I changed also the File: $WM_PROJECT_INST_DIR/ThirdParty-1.6.x/tools/makeParaViewFunctions.

When I run then the makeParaView script again, it starts quite well until this step:

Scanning dependencies of target vtkWrapPython
Scanning dependencies of target vtkWrapPythonInit
[ 0%] [ 0%] Building C object VTK/Wrapping/CMakeFiles/vtkWrapPython.dir/vtkWrapPython.c.o
Building C object VTK/Wrapping/CMakeFiles/vtkWrapPythonInit.dir/vtkWrapPythonInit.c.o

After this step it breaks up saying: this file not found
that file not found
the other file not found

what am I doing wrong??? Any Idea??
No idea. Best way to find out what went wrong is (I'm doing this from memory so be creative with commands and stuff) is go to the directory where compilation takes palce (this is something newly created ... not the source dir). There start the cmake-"GUI" with "ccmake .", Look for an option "Verbose MAkefiles". Switch that on. Check whether all the Python-related-stuff is OK. Then let it generate new makefiles. Start compilation manually with "make" in that directory. You should now get the exact command that failed
gschaider is offline   Reply With Quote

Old   September 24, 2010, 08:50
Default
  #9
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 14
alfa_8C is an unknown quantity at this point
Hy Bernhard,

thank you very much for your input. I didn't have even ccmake installed, and it's in fact far easier to handle!

But unfortunately it didn't solve my problem - I found the newly built directory and I checked all the PYTHON related options.
1)They are set all to ON.
2)Besides I switched the CMAKE Verbose Make option to ON as well,
3)and then configured with ccmake.
It configures fine no error!! But in Paraview the Python Shell Option under Tools is still deactivated. And your pyFoam script doesn't work neither - No module named paraview!

If I try to run "make" in the current directory after having completed point 3) - I receive the Error listed below.

p@poyry:~/OpenFOAM/ThirdParty-1.7.1/...araview-3.8.0$ make
[ 0%] Building C object VTK/Wrapping/CMakeFiles/vtkWrapPython.dir/vtkWrapPython.c.o
In file included from /home/poyry/OpenFOAM/ThirdParty-1.7.1/paraview-3.8.0/VTK/Common/vtkPython.h:46,

from /home/poyry/OpenFOAM/ThirdParty-1.7.1/paraview-3.8.0/VTK/Wrapping/vtkWrapPython.c:16:

/home/poyry/OpenFOAM/ThirdParty-1.7.1/paraview-3.8.0/VTK/Common/Python.h:7:24: error: patchlevel.h: No such file or directory

Do I have to set an environment variable or somthing??
The only one I set is in my .bashrc for OpenFAOM!!! That's it!
alfa_8C is offline   Reply With Quote

Old   September 24, 2010, 15:02
Default
  #10
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alfa_8C View Post
Hy Bernhard,

thank you very much for your input. I didn't have even ccmake installed, and it's in fact far easier to handle!

But unfortunately it didn't solve my problem - I found the newly built directory and I checked all the PYTHON related options.
1)They are set all to ON.
2)Besides I switched the CMAKE Verbose Make option to ON as well,
3)and then configured with ccmake.
It configures fine no error!! But in Paraview the Python Shell Option under Tools is still deactivated. And your pyFoam script doesn't work neither - No module named paraview!

If I try to run "make" in the current directory after having completed point 3) - I receive the Error listed below.

p@poyry:~/OpenFOAM/ThirdParty-1.7.1/...araview-3.8.0$ make
[ 0%] Building C object VTK/Wrapping/CMakeFiles/vtkWrapPython.dir/vtkWrapPython.c.o
In file included from /home/poyry/OpenFOAM/ThirdParty-1.7.1/paraview-3.8.0/VTK/Common/vtkPython.h:46,

from /home/poyry/OpenFOAM/ThirdParty-1.7.1/paraview-3.8.0/VTK/Wrapping/vtkWrapPython.c:16:

/home/poyry/OpenFOAM/ThirdParty-1.7.1/paraview-3.8.0/VTK/Common/Python.h:7:24: error: patchlevel.h: No such file or directory

Do I have to set an environment variable or somthing??
The only one I set is in my .bashrc for OpenFAOM!!! That's it!
patchlevel.h is a header that belongs to the Python-development-stuff. Have a look whether a package python-devel or similar is installed on your system.

Bernhard
gschaider is offline   Reply With Quote

Old   October 25, 2010, 12:49
Default
  #11
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 14
alfa_8C is an unknown quantity at this point
Hello Bernhard,

finally I could enable the python support in my Paraview
but unfortunately neither the loadstate nor the snapshot tool works...
I receive still the same error message:

poyry@CHZRH-WS-C10176:~/OpenFOAM/poyry-1.7.1/run/tutorials/incompressible/icoFoam/cavity$ pyFoamPVLoadState.py --state=cavity.psvm cavity
Traceback (most recent call last):
File "/usr/local/bin/pyFoamPVLoadState.py", line 3, in <module>
from PyFoam.Applications.PVLoadState import PVLoadState
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/PVLoadState.py", line 11, in <module>
from PyFoam.Paraview.ServermanagerWrapper import ServermanagerWrapper as SM
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Paraview/__init__.py", line 15, in <module>
from paraview import servermanager
ImportError: No module named paraview

It is strange - other applications of PyFoam like pyFoamPlotWatcher.py work well!

Any idea?
alfa_8C is offline   Reply With Quote

Old   October 27, 2010, 05:55
Default
  #12
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alfa_8C View Post
Hello Bernhard,

finally I could enable the python support in my Paraview
but unfortunately neither the loadstate nor the snapshot tool works...
I receive still the same error message:

poyry@CHZRH-WS-C10176:~/OpenFOAM/poyry-1.7.1/run/tutorials/incompressible/icoFoam/cavity$ pyFoamPVLoadState.py --state=cavity.psvm cavity
Traceback (most recent call last):
File "/usr/local/bin/pyFoamPVLoadState.py", line 3, in <module>
from PyFoam.Applications.PVLoadState import PVLoadState
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/PVLoadState.py", line 11, in <module>
from PyFoam.Paraview.ServermanagerWrapper import ServermanagerWrapper as SM
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Paraview/__init__.py", line 15, in <module>
from paraview import servermanager
ImportError: No module named paraview

It is strange - other applications of PyFoam like pyFoamPlotWatcher.py work well!

Any idea?
Seems like the directory with the pythonbindings is missing from the PYTHONPATH. Check in the PYTHONPATH all the directories with paraview in the name (there should be one)

Bernhard
gschaider is offline   Reply With Quote

Old   October 27, 2010, 11:52
Default
  #13
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 14
alfa_8C is an unknown quantity at this point
your hint led my in the right direction.

my variable or alias or whatever "$ParaView_DIR" that is used in the etc/apps/paraview/bashrc-file led me to the wrong path. Once set the whole right path instead of "$ParaView_DIR" within the paths containing "Utilities" in the etc/apps/paraview/bashrc-file, the pyFoamPVLoadState.py worked, whereas the snapshot utility still fails. but But there is a hint, that this is something ralated to all OF versions >=1.6.

Is this still an unsolved problem? If yes - are there other possibilities to do automatized postprozessing?

Best regards and thank you again for the hint,
Antonio
alfa_8C is offline   Reply With Quote

Old   October 28, 2010, 05:46
Default
  #14
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alfa_8C View Post
your hint led my in the right direction.

my variable or alias or whatever "$ParaView_DIR" that is used in the etc/apps/paraview/bashrc-file led me to the wrong path. Once set the whole right path instead of "$ParaView_DIR" within the paths containing "Utilities" in the etc/apps/paraview/bashrc-file, the pyFoamPVLoadState.py worked, whereas the snapshot utility still fails. but But there is a hint, that this is something ralated to all OF versions >=1.6.

Is this still an unsolved problem? If yes - are there other possibilities to do automatized postprozessing?

Best regards and thank you again for the hint,
Antonio
That is a rather nasty problem where the loading of Plugins does not work as advertised (and fails differently on different OSs and Paraview-versions) which makes the loading of PV3Reader-plugins fail. What should work is if you have a paraview with the "good" native raider built in (v.3.8 and higher) and you postprocessed with "touch test.foam;paraview" instead of paraFoam to generate snapshots. If that fails for you too please give me the error message you're getting

Bernhard
gschaider 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
[ICEM] Problems with coedge curves and surfaces tommymoose ANSYS Meshing & Geometry 6 December 1, 2020 11:12
[mesh manipulation] Problems with rotational cyclic boundaries TReviol OpenFOAM Meshing & Mesh Conversion 8 July 11, 2014 03:45
[ICEM] Flow channel meshing problems StefanG ANSYS Meshing & Geometry 19 May 15, 2012 06:44
Two-phase air water flow problems by activating Wall Lubrication Force challenger85 CFX 5 November 5, 2009 05:44
Help required to solve Hydraulic related problems aero CFX 0 October 30, 2006 11:00


All times are GMT -4. The time now is 22:34.