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

[PyFoam] on Ubuntu 16.04

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By zlw306

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 14, 2016, 11:20
Default on Ubuntu 16.04
  #1
New Member
 
Dan
Join Date: Nov 2013
Posts: 23
Rep Power: 12
Danubi is on a distinguished road
Hi all,

I'm having troubles with pyFoam installation. I have followed the wiki:

https://openfoamwiki.net/index.php/C...m#Installation

I didn't success installing in any way (as root, as user, using pip, etc.). I have decided to ask for help step by step.

First, right now I have installed pyfoam using pip. It has been installed into ~/.local/lib/python2.7/site/packages.

This is what I get when I run the steps proposed in the wiki page>

Code:
dan@dan-Gazelle:~$ python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29) 
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyFoam
>>> import PyFoam.FoamInformation
>>> print PyFoam.FoamInformation.foamTutorials()

>>> import sys
>>> print sys.path
['', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/dan/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0']
>>> 
dan@dan-Gazelle:~$ pyFoamVersion.py
Traceback (most recent call last):
  File "/usr/local/bin/pyFoamVersion.py", line 4, in <module>
    __import__('pkg_resources').run_script('PyFoam==0.6.5', 'pyFoamVersion.py')
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1496, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'pyFoamVersion.py'
What is it that I am doing wrong? Would anyone recommend a better way?

Thanks in advance
Danubi is offline   Reply With Quote

Old   July 14, 2016, 13:47
Default
  #2
Member
 
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 9
jf_vt is on a distinguished road
Hi
I dont know what is wrong but I can tell you that I installed pyfoam on ubuntu16.04 with pip and it worked like a charm.
Now for scientific work I use a locally installed anaconda python installation instead of the systm one's. It make things easier for me.
jf_vt is offline   Reply With Quote

Old   July 14, 2016, 15:14
Default
  #3
New Member
 
Dan
Join Date: Nov 2013
Posts: 23
Rep Power: 12
Danubi is on a distinguished road
Thank you jf_vt,

It is very good to hear that there should not be a problem at least!

Now I simply need to find mine...


Thanks!

PS: I'll check out the anaconda stuff too, the website looks fine, I wanna get my superpowers too ... hehehe
Danubi is offline   Reply With Quote

Old   July 14, 2016, 15:47
Default
  #4
Member
 
Jeff
Join Date: May 2016
Posts: 44
Rep Power: 9
jf_vt is on a distinguished road
your python version in /usr/lib it is a system installed version
it is usually not recomended to customize system version whih is used by the system.
I had install problems similar to yours in the past ( not with pyfoam) which I did not try to solve once I was advised to install my own version of python to work with( anaconda is a popular choice I like but you have many other options)
google it and you will find everyting you need.
JF
jf_vt is offline   Reply With Quote

Old   July 16, 2016, 09:50
Default
  #5
New Member
 
Dan
Join Date: Nov 2013
Posts: 23
Rep Power: 12
Danubi is on a distinguished road
Hei,

I have already tried to have a different version of python, in my case I used 3.5.2 in a user folder. It didn't succeed either.

I just saw today that there is a very new version of pyFoam (1 day old), the 0.6.6. These pyFoam amazing people just updated some details of the wiki page recommending the "pip" installation. I have tried to download as pip (succeed) but when I tried to import pyFoam in my python I got the following message:

Code:
dan@dan-Gazelle:~/src$ python
Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyFoam
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pyFoam
>>>
It happened with my default python 2.7.12 installation and with my 3.5.2 shot.

Hopefully the following hours-days the wiki page will be a bit more detailed, if not, please, anybody could drop some light? I am really willing to use pyFoam.

Thank you very much
Danubi is offline   Reply With Quote

Old   August 25, 2016, 13:10
Default
  #6
New Member
 
Join Date: Jul 2014
Posts: 26
Rep Power: 11
Minisasi is on a distinguished road
Hi,
Can it be just a typo in your case? From the same link you posted, it looks like PyFoam has a capital P

Code:
import PyFoam 
import PyFoam.FoamInformation 
print PyFoam.FoamInformation.foamTutorials()
In my case I managed to install PyFoam, but I cannot use it in OpenFoam4.0. I wanted to use the command
Code:
pyFoamPlotRunner.py  MySolverName
but I only get
Code:
pyFoamPlotRunner.py: command not found
Is anybody aware if the combo with OF4.0 is a successful one?
Thanks

Cheers
Minisasi is offline   Reply With Quote

Old   August 26, 2016, 03:43
Default
  #7
New Member
 
Dan
Join Date: Nov 2013
Posts: 23
Rep Power: 12
Danubi is on a distinguished road
Amazing,

My two posts (first and last) disagree with the capital 'P' or not capital 'p'.

I'll try it at some point in the following days and I write down my results.

Thank you!
Danubi is offline   Reply With Quote

Old   August 26, 2016, 12:54
Default
  #8
New Member
 
Join Date: Jul 2014
Posts: 26
Rep Power: 11
Minisasi is on a distinguished road
Oh and another thing that may help, but I am sure you have already checked it.
Before typing python and do all that import bla bla bla, I think you have to be in the openFoam shell
Minisasi is offline   Reply With Quote

Old   July 6, 2017, 12:13
Default
  #9
New Member
 
Liwei Zhang
Join Date: Jun 2017
Posts: 10
Rep Power: 8
zlw306 is on a distinguished road
I have used pip install PyFoam.everything seems well.But when i use print PyFoam.there is no message feedback.i hope someone can help me out...


Sent from my iPhone using CFD Online Forum mobile app
zlw306 is offline   Reply With Quote

Old   July 9, 2017, 07:45
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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
Quote:
Originally Posted by zlw306 View Post
I have used pip install PyFoam.everything seems well.But when i use print PyFoam.there is no message feedback.i hope someone can help me out...
Quick questions:
  1. Which specific installation mode did you use? Did you install it as root or as normal user?
  2. Does this command work?
    Code:
    pyFoamVersion.py --help
  3. Why did you try using "print PyFoam"?
__________________
wyldckat is offline   Reply With Quote

Old   July 9, 2017, 09:56
Default
  #11
New Member
 
Liwei Zhang
Join Date: Jun 2017
Posts: 10
Rep Power: 8
zlw306 is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick questions:
  1. Which specific installation mode did you use? Did you install it as root or as normal user?
  2. Does this command work?
    Code:
    pyFoamVersion.py --help
  3. Why did you try using "print PyFoam"?


I have figured it out.i used pip install pyfoam follow the openfoam wiki.but it default install dir is not the same with the environment variable writed on the openfoam wiki.So i need to change the pythonpath to where the pyfoam installed.


Sent from my iPhone using CFD Online Forum mobile app
wyldckat and LeeRuns like this.
zlw306 is offline   Reply With Quote

Old   July 28, 2017, 11:14
Default
  #12
New Member
 
Dan
Join Date: Nov 2013
Posts: 23
Rep Power: 12
Danubi is on a distinguished road
Minisasi you were right about the upper-lower case mistake....

Thank you!
Danubi is offline   Reply With Quote

Old   January 14, 2022, 10:37
Default
  #13
New Member
 
hadi
Join Date: Jun 2015
Posts: 12
Rep Power: 10
hadial is on a distinguished road
I had the same problem and FInally I figured it out as follows:


python3.8
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyFoam
>>> import PyFoam.FoamInformation
>>> print (PyFoam.FoamInformation.foamTutorials())
/opt/openfoam8/tutorials



Pay attention to first command python3.8
and also the print, it should be written inside pranthesis
hadial is offline   Reply With Quote

Reply

Tags
pyfoam ubuntu 16.04 pip


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] Can't find installation instruction for Openfoam 2.4.x , on Ubuntu 16.04 titanium OpenFOAM Installation 14 February 20, 2020 11:46
[OpenFOAM.com] Installation of OpenFOAM 1.7.1 on Ubuntu 16.04 MM_Khan OpenFOAM Installation 11 September 3, 2017 09:22
[foam-extend.org] foam-extend-3.2 on ubuntu 16.04 lts FlyBob91 OpenFOAM Installation 1 May 27, 2017 07:26
[OpenFOAM.org] Building OpenFOAM 3.0.1 on Ubuntu 16.04 - failed erico OpenFOAM Installation 30 February 2, 2017 09:24
[OpenFOAM.org] Building problem with Paraview 4.1.0 on Ubuntu 16.04 nigala OpenFOAM Installation 2 June 20, 2016 10:18


All times are GMT -4. The time now is 19:09.