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

[PyFoam] Using pyFoamPlotWatcher.py To Plot Residuals

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 3, 2017, 08:36
Default Using pyFoamPlotWatcher.py To Plot Residuals
  #1
Member
 
Matt Ridzon
Join Date: Jun 2014
Posts: 91
Rep Power: 12
m_ridzon is on a distinguished road
Reading through OpenFoam Technology Primer, it seems that "pyFoamPlotWatcher" can be used to monitor residuals during an OpenFoam solution. With the simple cavity model, I issued:

Code:
icoFoam > log1 &
pyFoamPlotWatcher.py log1
The plotter does nothing though and returns this:

Quote:
If 'pyFoamPlotWatcher.py' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf pyFoamPlotWatcher.py
Can anybody help me figure out how to use pyFoamPlotWatcher? I'm using OpenFoam 2.4.0, on OpenSuse 13.2, Gnome 3.14.1.

Thanks in advance,
M Ridzon
ramakant likes this.
m_ridzon is offline   Reply With Quote

Old   June 3, 2017, 11:44
Default
  #2
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Try to type a "dot" like log.run or log.1

Sent from my ASUS_X008D using CFD Online Forum mobile app
student666 is offline   Reply With Quote

Old   June 3, 2017, 16:47
Default
  #3
Senior Member
 
Wouter van der Meer
Join Date: May 2009
Location: Elahuizen, Netherlands
Posts: 203
Rep Power: 18
wouter is on a distinguished road
hello m_ridzon,
it looks to me that you did not install pyFoam and/or swak4foam.

hope this helps
Wouter
wouter is offline   Reply With Quote

Old   June 10, 2017, 08:11
Default
  #4
Member
 
Matt Ridzon
Join Date: Jun 2014
Posts: 91
Rep Power: 12
m_ridzon is on a distinguished road
Quote:
Originally Posted by student666 View Post
Try to type a "dot" like log.run or log.1
Unfortunately, adding a dot didn't help.

Quote:
Originally Posted by wouter View Post
hello m_ridzon,
it looks to me that you did not install pyFoam and/or swak4foam.

hope this helps
Wouter
I suspect it may need installed, but I'm still fairly new to Linux. Can you tell how to check if it's installed? And if I find it not installed, how would I then install it? I'm using OpenFoam 2.4.0, on OpenSuse 13.2, Gnome 3.14.1.

Thanks in advance,
M Ridzon
m_ridzon is offline   Reply With Quote

Old   June 10, 2017, 15:44
Default
  #5
Senior Member
 
khedar
Join Date: Oct 2016
Posts: 111
Rep Power: 10
khedar is on a distinguished road
run following on command line

Code:
pyFoamPlotWatcher.py --version
It should print something like

Code:
pyFoamPlotWatcher.py 0.6.6
The version number might be different though. For installation check out this link.

https://openfoamwiki.net/index.php/C...m#Installation
Anwer likes this.
khedar is offline   Reply With Quote

Old   June 17, 2017, 09:12
Default
  #6
Member
 
Matt Ridzon
Join Date: Jun 2014
Posts: 91
Rep Power: 12
m_ridzon is on a distinguished road
Quote:
Originally Posted by khedar View Post
run following on command line

Code:
pyFoamPlotWatcher.py --version
It should print something like

Code:
pyFoamPlotWatcher.py 0.6.6
The version number might be different though. For installation check out this link.

https://openfoamwiki.net/index.php/C...m#Installation
It did not print what you showed. Instead, it printed:
Code:
If 'pyFoamPlotWatcher.py' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf pyFoamPlotWatcher.py
So I then proceeded to follow your link and install pyFoamPlotWatcher. It didn't seem to work for me though. I issued:
Code:
sudo pip install PyFoam
At the end it gave me errors, but I'm not sure what they mean. I attached the LOG file to this forum post. Does anybody have any ideas what other steps I need to take?

Thanks again!
M Ridzon
Attached Files
File Type: zip pip.txt.zip (54.0 KB, 38 views)
m_ridzon is offline   Reply With Quote

Old   June 17, 2017, 13:41
Default cblas.h?
  #7
New Member
 
Maryam
Join Date: Dec 2015
Posts: 13
Rep Power: 10
Persia is on a distinguished road
Maybe you need to install OpenBLAS first. Follow this link for installation instructions: http://www.openblas.net/
Persia is offline   Reply With Quote

Old   June 19, 2017, 05:02
Default
  #8
Member
 
Ricky
Join Date: Jul 2014
Location: Germany
Posts: 78
Rep Power: 12
kera is on a distinguished road
It seems that some of the packages required for the installation is not installed on your system.

As per your error, and I quote:

Quote:

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
you need to install python-dev and python-setuptools, also mentioned here.

hope this helps!

Regards,
Ricky


Quote:
Originally Posted by m_ridzon View Post
It did not print what you showed. Instead, it printed:
Code:
If 'pyFoamPlotWatcher.py' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf pyFoamPlotWatcher.py
So I then proceeded to follow your link and install pyFoamPlotWatcher. It didn't seem to work for me though. I issued:
Code:
sudo pip install PyFoam
At the end it gave me errors, but I'm not sure what they mean. I attached the LOG file to this forum post. Does anybody have any ideas what other steps I need to take?

Thanks again!
M Ridzon
__________________
If it is easy, then something is fishy!
kera is offline   Reply With Quote

Old   June 24, 2017, 09:47
Default
  #9
Member
 
Matt Ridzon
Join Date: Jun 2014
Posts: 91
Rep Power: 12
m_ridzon is on a distinguished road
I noticed this error also:
Quote:
Originally Posted by kera View Post
It seems that some of the packages required for the installation is not installed on your system.

As per your error, and I quote:



you need to install python-dev and python-setuptools, also mentioned here.
So yes, I tried to install the python-dev and python-setuptools. I issued:
Code:
Matt@LinuxBox:~> sudo zypper install python-devel
root's password:
Loading repository data...
Warning: Repository 'openSUSE-13.2-Update' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'openSUSE-13.2-Update-Non-Oss' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...
'python-devel' is already installed.
No update candidate for 'python-devel-2.7.12-3.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...

Nothing to do.

Matt@LinuxBox:~> sudo zypper install python-setuptools
Loading repository data...
Warning: Repository 'openSUSE-13.2-Update' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'openSUSE-13.2-Update-Non-Oss' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  python-setuptools

1 new package to install.
Overall download size: 310.4 KiB. Already cached: 0 B  After the operation,
additional 1.3 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package python-setuptools-5.4.1-2.1.4.noarch
                                           (1/1), 310.4 KiB (  1.3 MiB unpacked)
Retrieving: python-setuptools-5.4.1-2.1.4.noarch.rpm .....................[done]
Checking for file conflicts: .............................................[done]
(1/1) Installing: python-setuptools-5.4.1-2.1.4 ..........................[done]
I also installed OpenBLAS per this reply:
Quote:
Originally Posted by Persia View Post
Maybe you need to install OpenBLAS first. Follow this link for installation instructions: http://www.openblas.net/
The OpenBLAS installation appeared to go smoothly after downloading it and issuing "make".

I again issued:
Code:
sudo pip install PyFoam
I get compile errors again though, which are shown in my new attachment.

Any thoughts?

Thanks again!
M Ridzon
Attached Files
File Type: txt pip2.txt (31.7 KB, 8 views)
m_ridzon is offline   Reply With Quote

Old   June 25, 2017, 08:30
Default
  #10
Member
 
Matt Ridzon
Join Date: Jun 2014
Posts: 91
Rep Power: 12
m_ridzon is on a distinguished road
As I continue to try and debug this, I issued this:
Code:
pyFoamVersion.py
and got this:
Code:
Machine info: Linux | LinuxBox | 3.16.7-21-desktop | #1 SMP PREEMPT Tue Apr 14 07:11:37 UTC 2015 (93c1539) | x86_64 | x86_64

Python version: 3.4.5 (default, Jul 03 2016, 13:55:08) [GCC]

Python executable: /usr/bin/python3

Python 3 is supported with PyFoam
PYTHONPATH is not set

Location of this utility: /usr/bin/pyFoamVersion.py

 PyFoam WARNING on line 201 of file /usr/lib/python3.4/site-packages/PyFoam/FoamInformation.py : Basedir /home/Matt/foam for fork extend does not exist or is not a directory 
Version 4.0 (reported as number 4.0 )Fork openfoam of the installed 3 versions:
openfoam-2.3.1 : /home/Matt/OpenFOAM/OpenFOAM-2.3.1
openfoam-2.4.0 : /home/Matt/OpenFOAM/OpenFOAM-2.4.0
  openfoam-4.0 : /home/Matt/OpenFOAM/OpenFOAM-4.0

pyFoam-Version: 0.6.7

Path where PyFoam was found (PyFoam.__path__) is ['/usr/lib/python3.4/site-packages/PyFoam']

Configuration search path: [('file', '/etc/pyFoam/pyfoamrc'), ('directory', '/etc/pyFoam/pyfoamrc.d'), ('file', '/home/Matt/.pyFoam/pyfoamrc'), ('directory', '/home/Matt/.pyFoam/pyfoamrc.d')]
Configuration files (used): []

Installed libraries:
cython                         :  No      Not used. Maybe will by used later to spped up parts of PyFoam 
cProfile                       :  Yes 
docutils                       :  No      Not necessary. Needed for RestructuredText to HTML conversion 
Gnuplot                        :  No      Not a problem. Version from ThirdParty is used 
hotshot                        :  No      Not a problem. Can't profile using this library 
line_profiler                  :  No      Not a problem. Can't profile using this library 
ipdb                           :  No      Not necessary. Only makes debugging more comfortable 
IPython                        :  No      Not necessary. But the interactive shell may be more comfortable 
matplotlib                     :  No      Only Gnuplot-plotting possible 
mercurial                      :  No      Not a problem. Used for experimental case handling 
pytest                         :  No      Only needed for running the unit-tests (developers only) 
numpy                          :  No      Plotting and data comparison won't work 
numpypy                        :  No      This workaround for PyPy does not work 
openpyxl                       :  No      Not a problem. Only used for exporting pandas-data to Excel-files (advanced). If xlsxwriter is installed it will handle this (xlsxwriter is recommended anyway) 
xlsxwriter                     :  No      Not a problem. Only used for exporting pandas-data to XLSX-files (advanced). If openpyxl is installed then this module can handle that 
pandas                         :  No      Not a problem. Only used for handling of advanced data-handling 
ply                            :  No      Not a problem. Version from ThirdParty is used 
profile                        :  Yes 
psyco                          :  No      Not a problem. Acceleration not possible 
PyQt4                          :  No      Only some experimental GUI-stuff relies on this 
PyQt4.Qwt5                     :  No      Only an alternate plotting back-end 
scipy                          :  No      Not yet used. Possibly use signal-fitting etc 
Tkinter                        :  No      Not a problem. Used for the old version of DisplayBlockmesh and some matplotlib-implementations 
twisted                        :  No      Not yet used. Possibly reimplement MetaServer with it 
vtk                            :  No      Not a problem. Only used for some utilities 
xlwt                           :  No      Not a problem. Only used for exporting pandas-data to Excel-files 
xlrd                           :  No      Not a problem. Only used for importing Excel-files to pandas-data 
requests                       :  No      Not a problem. Currently only needed for the blink(1)-support 
PyFoam.ThirdParty.ply.yacc     :  Yes      version: 3.9 
PyFoam.ThirdParty.Gnuplot      :  No      This is our own. If it is not found we've got problems 
PyFoam.ThirdParty.tqdm         :  Yes      version: 4.8.4 
PyFoam.ThirdParty.IPy          :  Syntax Error      This is our own. If it is not found we've got problems 
PyFoam.ThirdParty.pyratemp     :  Yes      version: 0.2.0 
PyFoam.ThirdParty.six          :  Yes      version: 1.10.0 
PyFoam.ThirdParty.winhacks     :  Yes 

Library locations
cProfile                       : /usr/lib64/python3.4/cProfile.py
profile                        : /usr/lib64/python3.4/profile.py
PyFoam.ThirdParty.ply.yacc     : /usr/lib/python3.4/site-packages/PyFoam/ThirdParty/ply/yacc.py
PyFoam.ThirdParty.pyratemp     : /usr/lib/python3.4/site-packages/PyFoam/ThirdParty/pyratemp.py
PyFoam.ThirdParty.six          : /usr/lib/python3.4/site-packages/PyFoam/ThirdParty/six.py
PyFoam.ThirdParty.tqdm         : /usr/lib/python3.4/site-packages/PyFoam/ThirdParty/tqdm/__init__.py
PyFoam.ThirdParty.winhacks     : /usr/lib/python3.4/site-packages/PyFoam/ThirdParty/winhacks.py

Checking additional envirnoment variables

Checking for PYFOAM_DIR : Location of the PyFoam-installation. Not strictly necessary
PYFOAM_DIR missing from environment

Checking for PYFOAM_SITE_DIR : Location of non-PyFoam-disctributions script. Set and used by some Foam-distributions
PYFOAM_SITE_DIR missing from environment

User information
Temporary directory:  /tmp/PyFoam_Matt
I also issued:
Code:
pyFoamPlotWatcher.py --version
and got this:
Code:
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/PyFoam/ThirdParty/Gnuplot/PlotItems.py", line 28, in <module>
    import numpy
ImportError: No module named 'numpy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pyFoamPlotWatcher.py", line 3, in <module>
    from PyFoam.Applications.PlotWatcher import PlotWatcher
  File "/usr/lib/python3.4/site-packages/PyFoam/Applications/PlotWatcher.py", line 6, in <module>
    from PyFoam.Execution.GnuplotRunner import GnuplotWatcher
  File "/usr/lib/python3.4/site-packages/PyFoam/Execution/GnuplotRunner.py", line 4, in <module>
    from .StepAnalyzedCommon import StepAnalyzedCommon
  File "/usr/lib/python3.4/site-packages/PyFoam/Execution/StepAnalyzedCommon.py", line 6, in <module>
    from PyFoam.Execution.AnalyzedCommon import AnalyzedCommon
  File "/usr/lib/python3.4/site-packages/PyFoam/Execution/AnalyzedCommon.py", line 7, in <module>
    from PyFoam.Basics.PlotTimelinesFactory import createPlotTimelines,createPlotTimelinesDirect
  File "/usr/lib/python3.4/site-packages/PyFoam/Basics/PlotTimelinesFactory.py", line 4, in <module>
    from PyFoam.Basics.GnuplotTimelines import GnuplotTimelines,validTerminals
  File "/usr/lib/python3.4/site-packages/PyFoam/Basics/GnuplotTimelines.py", line 4, in <module>
    from PyFoam.ThirdParty.Gnuplot import Gnuplot,Data,gp
  File "/usr/lib/python3.4/site-packages/PyFoam/ThirdParty/Gnuplot/__init__.py", line 166, in <module>
    from .PlotItems import PlotItem, Func, File, Data, GridData
  File "/usr/lib/python3.4/site-packages/PyFoam/ThirdParty/Gnuplot/PlotItems.py", line 31, in <module>
    import numpypy
ImportError: No module named 'numpypy'
I keep seeing warnings about numpy missing. So taking a guess at it, I issued:
Code:
sudo zypper install python-numpy
and got this:
Code:
Loading repository data...
Warning: Repository 'openSUSE-13.2-Update' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'openSUSE-13.2-Update-Non-Oss' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...
'python-numpy' is already installed.
No update candidate for 'python-numpy-1.9.0-1.6.x86_64'. The highest available version is already installed.
Resolving package dependencies...

Nothing to do.
This infers that numpy is already installed. But I'm not sure why pyFoam can't find it.

Any ideas?

Thanks again,
M Ridzon
m_ridzon is offline   Reply With Quote

Old   July 1, 2017, 10:20
Default
  #11
Member
 
Matt Ridzon
Join Date: Jun 2014
Posts: 91
Rep Power: 12
m_ridzon is on a distinguished road
Update. I think I found it. I installed numpy-devel, since it looked like it was missing. I re-ran the installation for PyFoam and got this:
Code:
Matt@LinuxBox:~> sudo pip install PyFoam
root's password:
Requirement already satisfied (use --upgrade to upgrade): PyFoam in /usr/lib/python3.4/site-packages
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib64/python3.4/site-packages (from PyFoam)
Cleaning up...
Matt@LinuxBox:~> pyFoamPlotWatcher.py --version
pyFoamPlotWatcher.py 0.6.7
I ran a sample simulation and gnuplot opened and plotted the residuals in real time, which was what I'm after. Great! Now on to learning how to use gnuplot so I can zoom and set views for more sensible plot viewing. I'll poke around Google to try and figure that out.

Thanks,
M Ridzon
aerospaceman likes this.
m_ridzon is offline   Reply With Quote

Old   January 22, 2021, 05:55
Default pyFoam installation issue
  #12
New Member
 
Join Date: Dec 2020
Posts: 26
Rep Power: 5
OlivierM is on a distinguished road
Hi,

I went through your process but unfortunately that didn't work for me

#
$ sudo pip install PyFoam
sudo: pip: command not found

$ sudo pip3 install PyFoam
Requirement already satisfied: PyFoam in /usr/local/lib/python3.8/dist-packages/PyFoam-2020.5-py3.8.egg (2020.5) Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from PyFoam) (1.17.4)

$ pyFoamPlotWatcher.py --version
Traceback (most recent call last):
File "/usr/local/bin/pyFoamPlotWatcher.py", line 4, in <module>
__import__('pkg_resources').run_script('PyFoam==20 20.5', 'pyFoamPlotWatcher.py')
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1452, in run_script
raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/pyFoamPlotWatcher.py' not found in metadata at '/home/<USER>/.local/lib/python3.8/site-packages/PyFoam-2020.5.dist-info'
#

would you have any idea of what coul be the problem ?

I am running OFv2012 on Unbuntu 20.04 LTS wl2

many thanks
OlivierM is offline   Reply With Quote

Old   January 24, 2021, 19:11
Default
  #13
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 OlivierM View Post
Hi,

I went through your process but unfortunately that didn't work for me

#
$ sudo pip install PyFoam
sudo: pip: command not found

$ sudo pip3 install PyFoam
Requirement already satisfied: PyFoam in /usr/local/lib/python3.8/dist-packages/PyFoam-2020.5-py3.8.egg (2020.5) Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from PyFoam) (1.17.4)

$ pyFoamPlotWatcher.py --version
Traceback (most recent call last):
File "/usr/local/bin/pyFoamPlotWatcher.py", line 4, in <module>
__import__('pkg_resources').run_script('PyFoam==20 20.5', 'pyFoamPlotWatcher.py')
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1452, in run_script
raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/pyFoamPlotWatcher.py' not found in metadata at '/home/<USER>/.local/lib/python3.8/site-packages/PyFoam-2020.5.dist-info'
#

would you have any idea of what coul be the problem ?

I am running OFv2012 on Unbuntu 20.04 LTS wl2

many thanks

Hm. Strange. pkg_resource is never used in the PyFoam-sources so the script at /usr/local/bin/pyFoamPlotWatcher.py seems to be an automatically generated script that calls the original.
I can't reproduce this on my Ubuntu 18.04 with Python 3.8 so it seems to by a 20.04 problem (probably Canonical trying to reinvent the wheel in an improved way)


Does pyFoamVersion.py work and what is the output of that (PLEASE use the CODE-environment when adding computer output to your posts here. It makes things easier to read as it won't be reformatted)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   January 25, 2021, 02:50
Default
  #14
New Member
 
Join Date: Dec 2020
Posts: 26
Rep Power: 5
OlivierM is on a distinguished road
Hi,
I can see the pyFoam installed version here below:

#
$ pip3 install pyFoam
> Requirement already satisfied: pyFoam in ./.local/lib/python3.8/site-packages (2020.5)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from pyFoam) (1.17.4)
#

but if I run 'pyFoamVersion.py' then I get the following:

#
$ pyFoamVersion.py
> Traceback (most recent call last):
File "/usr/local/bin/pyFoamVersion.py", line 4, in <module>
__import__('pkg_resources').run_script('PyFoam==20 20.5', 'pyFoamVersion.py')
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1452, in run_script
raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/pyFoamVersion.py' not found in metadata at
'/home/<USER>/.local/lib/python3.8/site-packages/PyFoam-2020.5.dist-info'
#

sorry but I don't know what you mean by using the the CODE-environment.
... could you kindly explain me how to do that ?

thank you
OlivierM is offline   Reply With Quote

Old   January 25, 2021, 06:23
Default
  #15
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 OlivierM View Post
Hi,
I can see the pyFoam installed version here below:

#
$ pip3 install pyFoam
> Requirement already satisfied: pyFoam in ./.local/lib/python3.8/site-packages (2020.5)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from pyFoam) (1.17.4)
#

but if I run 'pyFoamVersion.py' then I get the following:

#
$ pyFoamVersion.py
> Traceback (most recent call last):
File "/usr/local/bin/pyFoamVersion.py", line 4, in <module>
__import__('pkg_resources').run_script('PyFoam==20 20.5', 'pyFoamVersion.py')
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1452, in run_script
raise ResolutionError(
pkg_resources.ResolutionError: Script 'scripts/pyFoamVersion.py' not found in metadata at
'/home/<USER>/.local/lib/python3.8/site-packages/PyFoam-2020.5.dist-info'
#

sorry but I don't know what you mean by using the the CODE-environment.
... could you kindly explain me how to do that ?

thank you
When you look in the editor there is an icon with a # (help text: "Wrap CODE tags around selected text")


Problem seems to be that in the sources most PyFoam-scripts look like this
Code:
#! /usr/bin/env python 

from PyFoam.Applications.PlotWatcher import PlotWatcher 

 PlotWatcher()
when pip installs them it usually rewrites them to something like
Code:
#! /usr/bin/python38 

from PyFoam.Applications.PlotWatcher import PlotWatcher 

  PlotWatcher()
to make sure that the python-interpreter of the pip-tool is always used. Seems that in your case it completely rewrites it to indirectly get the script from somewhere else (what confuses me is that your script is installed on a system level but then tries to access files that belong to the user). I don't know what it is. I tried reproducing it on my machine with Python 3.8 and it works as expected. So it is either a speciality of Ubuntu 20-04 or the WSL environment


Could you post the content of your /usr/local/bin/pyFoamVersion.py (only the first few lines if it is longer than 10 lines)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   January 25, 2021, 06:44
Default
  #16
New Member
 
Join Date: Dec 2020
Posts: 26
Rep Power: 5
OlivierM is on a distinguished road
here is the content of pyFoamVersion.py:

#!/usr/bin/python3
# EASY-INSTALL-SCRIPT: 'PyFoam==2020.5','pyFoamVersion.py'
__requires__ = 'PyFoam==2020.5'
__import__('pkg_resources').run_script('PyFoam==20 20.5', 'pyFoamVersion.py')
OlivierM is offline   Reply With Quote

Old   January 25, 2021, 07:54
Default
  #17
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 OlivierM View Post
here is the content of pyFoamVersion.py:

#!/usr/bin/python3
# EASY-INSTALL-SCRIPT: 'PyFoam==2020.5','pyFoamVersion.py'
__requires__ = 'PyFoam==2020.5'
__import__('pkg_resources').run_script('PyFoam==20 20.5', 'pyFoamVersion.py')

That would have been a good example to demonstrate that you understood the CODE-tag


Anyway: that is strange. This script looks like it was installed with easy_install (which is old tech) not pip. You did not try to install it with a different way before you tried pip?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   January 25, 2021, 09:40
Default
  #18
New Member
 
Join Date: Dec 2020
Posts: 26
Rep Power: 5
OlivierM is on a distinguished road
well,
apologies again for the CODE-tag.

I don't remember having tried anything else than pip (or pip3 indeed)

if I come back to the error then the last line quotes the following message:


Quote:
pkg_resources.ResolutionError: Script 'scripts/pyFoamVersion.py' not found in metadata at '/home/oml_400/.local/lib/python3.8/site-packages/PyFoam-2020.5.dist-info'
here is the METADATA content:

Quote:
Metadata-Version: 2.0
Name: PyFoam
Version: 2020.5
Summary: Python Utilities for OpenFOAM
Home-page: http://openfoamwiki.net/index.php/Contrib/PyFoam
Author: Bernhard F.W. Gschaider
Author-email: bgschaid@hfd-research.com
License: GPL
Keywords: cfd openfoam
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy

# Table of Contents

1. [What it is](#org8e27d27)
2. [Installation](#org5380b22)
3. [License](#orgf26070d)
4. [Contributors](#org0388d7f)
5. [Further reading](#org820f59e)
6. [This document](#orgca16204)


<a id="org8e27d27"></a>

# What it is

The purpose of this library is to support working with the OpenSource
CFD-toolbox [OpenFOAM](http://www.openfoam.org) and its forks

This [Python](http://www.python.org) library can be used to

- analyze the logs produced by OpenFoam-solvers
- execute OpenFoam-solvers and utilities and analyze their output
simultaneously
- manipulate the parameter files and the initial-conditions of a run
in a non-destructive manner
- plots the residuals of OpenFOAM solvers
- lots of other stuff

Most of this functionality is made available to the user in the form
of command-line utilities.

PyFoam does all this strictly "from the outside": by writing parameter
files and reading the output of the solvers. Without compiled parts or
being linked to OpenFOAM.

More information is found on [the OpenFOAM Wiki](http://openfoamwiki.net/index.php/Contrib_PyFoam).
Introductory presentations on PyFoam can be found there


<a id="org5380b22"></a>

# Installation

The easiest way to install PyFoam is the Python package-manager `pip`:

pip install PyFoam

which will install PyFoam


<a id="orgf26070d"></a>

# License

PyFoam is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version. See the file COPYING in this directory,
for a description of the GNU General Public License terms under which
you can copy the files.


<a id="org0388d7f"></a>

# Contributors

If not otherwise noted in a source-files the primary author is Bernhard Gschaider

The people who contributed to PyFoam (If I forgot someone: tell me):

- Bernhard Gschaider
- Martin Beaudoin
- Fabian Pollesböck
- Etienne Lorriaux
- Bruno Santos
- Marc Immer
- Oliver Borm


<a id="org820f59e"></a>

# Further reading

These documents give further information

- **ReleaseNotes:** list of the changes between versions (newest
versions are on top).
- **DeveloperNotes:** document with information for people who want to
contribute to `PyFoam`

For information on the usage see the presentations on [the `PyFOAM`
page on the OpenFOAM-Wiki](https://openfoamwiki.net/index.php/Contrib_PyFoam)


<a id="orgca16204"></a>

# This document

The original source of this document is `README.org`. The
`README.md` (to which the `README` links) is automatically generated
and should **not** be edited. The reason for this setup is that most
Web-GUIs for VCS insist on Markdown as a markup language

here is the metadata.json content:

Code:
{"classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9"], "description_content_type": "text/markdown", "extensions": {"python.details": {"contacts": [{"email": "bgschaid@hfd-research.com", "name": "Bernhard F.W. Gschaider", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "http://openfoamwiki.net/index.php/Contrib/PyFoam"}}}, "extras": [], "generator": "bdist_wheel (0.30.0)", "keywords": ["cfd", "openfoam"], "license": "GPL", "metadata_version": "2.0", "name": "PyFoam", "run_requires": [{"requires": ["numpy"]}], "summary": "Python Utilities for OpenFOAM", "version": "2020.5"}
is that helping ?

should I uninstall pyFoam and reinstall it ?
OlivierM is offline   Reply With Quote

Old   January 25, 2021, 10:07
Default
  #19
New Member
 
Join Date: Dec 2020
Posts: 26
Rep Power: 5
OlivierM is on a distinguished road
to complete the overview I have found 7 versions of the pyFoamVersion.py file:

the one under Ubuntu-20.04\home\<USER>\PyFoam-2020.5\PyFoam-2020.5\bin quotes these first 10 lines:
Code:
#!/usr/bin/env python
# Original provided by Mark Olesen

import os,sys
from platform import uname

# from __future__ import print_function
try:
    from PyFoam.ThirdParty.six import print_
except ImportError:
the one under Ubuntu-20.04\usr\local\bin quotes as follow:
Code:
#!/usr/bin/python3
# EASY-INSTALL-SCRIPT: 'PyFoam==2020.5','pyFoamVersion.py'
__requires__ = 'PyFoam==2020.5'
__import__('pkg_resources').run_script('PyFoam==2020.5', 'pyFoamVersion.py')
the one under Ubuntu-20.04\usr\local\lib\python3.8\dist-packages\PyFoam-2020.5-py3.8.egg\EGG-INFO\scripts quotes these first 10 lines:
Code:
#!/usr/bin/python3
# Original provided by Mark Olesen

import os,sys
from platform import uname

# from __future__ import print_function
try:
    from PyFoam.ThirdParty.six import print_
except ImportError:
the one under Ubuntu-20.04\home\<USER>\PyFoam-2020.5\PyFoam-2020.5\build\scripts-3.8 quotes these first 10 lines:
Code:
#!/usr/bin/python3
# Original provided by Mark Olesen

import os,sys
from platform import uname

# from __future__ import print_function
try:
    from PyFoam.ThirdParty.six import print_
except ImportError:

the one under Ubuntu-20.04\home\<USER>\PyFoam\bin quotes these first 10 lines:
Code:
#!/usr/bin/env python
# Original provided by Mark Olesen

import os,sys
from platform import uname

# from __future__ import print_function
try:
    from PyFoam.ThirdParty.six import print_
except ImportError:

the one under Ubuntu-20.04\home\<USER>\.local\bin quotes these first 10 lines:
Code:
#!/usr/bin/python3
# Original provided by Mark Olesen

import os,sys
from platform import uname

# from __future__ import print_function
try:
    from PyFoam.ThirdParty.six import print_
except ImportError:

the one under Ubuntu-20.04\home\<USER>\dist\PyFoam-2020.5\PyFoam-2020.5\bin quotes these first 10 lines:
Code:
#!/usr/bin/env python
# Original provided by Mark Olesen

import os,sys
from platform import uname

# from __future__ import print_function
try:
    from PyFoam.ThirdParty.six import print_
except ImportError:
OlivierM is offline   Reply With Quote

Old   January 25, 2021, 16:07
Default
  #20
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 OlivierM View Post
to complete the overview I have found 7 versions of the pyFoamVersion.py file:

the one under Ubuntu-20.04\home\<USER>\PyFoam-2020.5\PyFoam-2020.5\bin quotes these first 10 lines:
<snip>
They all look good except for the one that is actually used. Which could also work but looks for the script in the wrong place. Best advice I can give you: "pip uninstall PyFoam". Make sure that none of these files is present anymore. Try "pip install" again. If it doesn't work check whether all these files are there again
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
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
[Tutorials] Tutorial of how to plot residuals ! wolle1982 OpenFOAM Community Contributions 171 February 20, 2024 03:55
How to plot residuals vs iterations using pyFoam... ata313ata Visualization & Post-Processing 1 February 6, 2018 05:34
Plot the residuals over all the domain Douglas OpenFOAM Post-Processing 0 June 27, 2017 17:01
plot residuals pigna OpenFOAM Running, Solving & CFD 2 December 19, 2014 03:32
How to plot residuals of all iterations in Fluent FJSJ FLUENT 4 September 20, 2013 10:47


All times are GMT -4. The time now is 02:46.