installation problems sundials and cantera under python

452 views
Skip to first unread message

MortI80

unread,
Apr 21, 2015, 10:36:46 AM4/21/15
to canter...@googlegroups.com
Hi everybody,

I have some problems installing cantera following the guide under http://www.cantera.org/docs/sphinx/html/install.html#mac-os-x

1. sundials-installation problem: 

terminal-script:
brew install python scons sundials

Warning: python-2.7.9 already installed

Warning: scons-2.3.4 already installed

==> Downloading https://computation.llnl.gov/casc/sundials/download/code/sundial


curl: (22) The requested URL returned error: 404 Not Found

Error: Failed to download resource "sundials"


Download failed: https://computation.llnl.gov/casc/sundials/download/code/sundials-2.5.0.tar.gz



hence, sundials must be installed separately...  - so I had to register to download the newest tag.gz-file... but since I am a 
newbe, do you know how to install sundials after getting the whole archive? I unpacked the archive and tried to follow the instructions in the Installation Guide. Therefore I installed Cmake in addition and tried to install it using this program. But how can I check if everything was installed correctly?

2. python - cantera problem:

I usually use cantera via Matlab 2014b. That works. However, I would like to use python3 or python2 in addition to that... but whatever I do, cantera is never part of my side-package path:
python script:
import cantera
Traceback (most recent call last):
 
File "<pyshell#1>", line 1, in <module>
   
import cantera
ImportError: No module named 'cantera'
import sys
print(sys.path)
'/usr/local/lib/python3.4/site-packages/setuptools-15.0-py3.4.egg', '/usr/local/lib/python3.4/site-packages/pip-6.1.0-py3.4.egg', '/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python34.zip', '/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4', '/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin', '/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/site-packages']

Does anybody know what I do wrong or how I can fixed this problem?

My system:
Mac: OS X Yosemite, Version 10.10.3
Matlab 2014b
Python3
Python2.7.9

Thanks in advance and all the best... 


Ray Speth

unread,
Apr 21, 2015, 6:38:16 PM4/21/15
to canter...@googlegroups.com
Hi,

First, that error downloading Sundials indicates that you haven't updated your Homebrew formulas in a while. The current formula for Sundials should either download it from the mirror at ftp.mcs.anl.gov or download a pre-compiled 'Bottle' from SourceForge.

Second, Cantera is not yet compatible with the new Sundials 2.6, so you need to install Sundials 2.5 anyway (which is what the Homebrew formula will still do).

Finally, it's not clear what happened when you installed Cantera (or even how you installed Cantera). What is the output of 'brew info cantera'? Cantera should never actually appear in sys.path -- it should end up in the 'cantera' subdirectory of /usr/local/lib/python2.7/site-packages/, which should be on your Python path. The Python 3 package will only be installed if the extra prerequisites for that are also installed, namely the Python 3 versions of Cython and Numpy. If you install Cantera with the '-v' flag passed to 'brew install', there should be a warning message near the top of the build output that explains why it isn't building the Python 3 module, if it is skipping it.

Regards,
Ray

MortI80

unread,
Apr 22, 2015, 6:31:54 AM4/22/15
to canter...@googlegroups.com
Hi Ray,

thanks for your fast answer...

1. how can I update the Homebrew formulas?
2. That is the output of 'brew info cantera':
cantera: stable 1.8.0-beta, HEAD
http
://code.google.com/p/cantera/
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/cantera.rb
==> Dependencies
Required: graphviz
==> Caveats
The license, demos, tutorials, data, etc. can be found in:
 
/usr/local/opt/cantera

Try the following in python to find the equilibrium composition of a
stoichiometric methane
/air mixture at 1000 K and 1 atm:
>>> import Cantera
>>> g=Cantera.GRI30()
>>> g.set(X='CH4:1, O2:2, N2:8', T=1000, P=Cantera.OneAtm)
>>> g.equilibrate('TP')
>>> g


Additional Information: there is no folder "Cantera" in the subdirectories:
  • usr/local/lib/python2.7/site-packages/
  • usr/local/lib/python3.3/site-packages/
  • usr/local/lib/python3.4/site-packages/
Cython and Numpy are installed.

MortI80

unread,
Apr 22, 2015, 7:22:30 AM4/22/15
to canter...@googlegroups.com
Regarding question 1: I ran "brew update" but I still get the following error:

>>> brew install python scons sundials


Warning: python-2.7.9 already installed

Warning: scons-2.3.4 already installed



curl: (22) The requested URL returned error: 404 Not Found
Error: Failed to download resource "sundials"

Download failed: https://computation.llnl.gov/casc/sundials/download/code/sundials-2.5.0.tar.gz

>>>
Any idea? 
All the best and thx

Ray Speth

unread,
Apr 22, 2015, 10:36:12 AM4/22/15
to canter...@googlegroups.com
Hi,

I see two problems right off the bat. First, that's also a very old Homebrew formula for Cantera -- the current version is 2.1.2, not 1.8.0-beta. Second, as 'brew info' says, it's not even installed. I don't know why 'brew update' isn't making the current formulas available. Have you tried running 'brew doctor'? Did you tap homebrew/science (what is the output of 'brew tap'? Have you tried 'brew tap --repair'? What is the output of 'brew config'?

Regards,
Ray

MortI80

unread,
Apr 23, 2015, 8:41:15 AM4/23/15
to canter...@googlegroups.com
Hi Ray,

it worked now. I just removed homebrew - so it seemed to be installed - and installed it again. After that it worked. It got the right link for sundials 2.5 and it was possible to follow the rest of the "normal" cantera installation routine. Now cantera runs under python and matlab. Great and thanks for your fantastic help. This is my new output of "brew info cantera"

cantera: stable 2.1.2, HEAD

http://code.google.com/p/cantera/

/usr/local/Cellar/cantera/2.1.2 (1180 files, 79M) *

 Built from source with: --with-matlab=

From: https://github.com/homebrew/homebrew-science/blob/master/cantera.rb

==> Dependencies

Build: scons

Recommended: sundials

Optional: graphviz

==> Options

--with-graphviz

       Build with graphviz support

--with-matlab=

       Path to Matlab root directory

--with-python3

       Build with python3 support

--without-check

       Disable build-time checking (not recommended)

--without-sundials

       Build without sundials support

--HEAD

       Install HEAD version

==> Caveats

The license, demos, tutorials, data, etc. can be found in:

 /usr/local/opt/cantera


Try the following in python to find the equilibrium composition of a

stoichiometric methane/air mixture at 1000 K and 1 atm:

>>> import cantera as ct

>>> g = ct.Solution('gri30.cti')

>>> g.TPX = 1000, ct.one_atm, 'CH4:1, O2:2, N2:8'

>>> g.equilibrate('TP')

>>> g()


this is the output of "brew tap"

homebrew/science

 
this it the current output of "brew info"

HOMEBREW_VERSION: 0.9.5

ORIGIN: https://github.com/Homebrew/homebrew

HEAD: 7a1327defb8146a0c9d915067abcc55103fb75ad

Last commit: 26 hours ago

HOMEBREW_PREFIX: /usr/local

HOMEBREW_CELLAR: /usr/local/Cellar

CPU: 8-core 64-bit haswell

OS X: 10.10.3-x86_64

Xcode: 6.3.1

CLT: 6.3.1.0.1.1429149539

Clang: 6.1 build 602

X11: 2.7.7 => /opt/X11

System Ruby: 2.0.0-p481

Perl: /usr/bin/perl

Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/bin/python2.7

Ruby: /usr/bin/ruby

Java: 1.6.0_65






It would actually be great to have a program to change the syntax of scripts from python to matlab. So, examples could then be used in both environments.

All the best and cheers!
Reply all
Reply to author
Forward
0 new messages