After struggling to install Cantera with Matlab and python I finally
managed to do so.
I figured that others may have similar problems so I documented my
steps
This is my setup:
OSX10.5.7 but most of the stuff should be the same for other OS's I
think
The following steps installs
Cantera from SVN vers 266
Sundials 2.4
Python 2.64
As well as other tools needed to run cantera.
There may be additional parts needed but this is what I did:
Python and other prerequisites:
I had problems with the default install of Python so I upgraded it.
Best way (I think) to do so is to use Macports
Install XCode and all the developers tools from Apple. You can either
find it on the CD or from Apple's webpage
Install Macports.
From Macports you can then install most of the required tools.
In order to upgrade Python I sugest that you install
python_select
The way to to do this from macports is:
sudo port install python_select
With this tool you can jump from version 2.5 that is the default
installation in OSX to Python 2.5 or e.g 2.6 etc that is the
standard python dist. OSX use some features in Python so DO NOT remove
the original installation.
Then install
Python 2.6.4 or Python 2.5
( I installed 2.6.4)
sudo port install python26
After you have installed python 2.6.4, change your default python to
python 2.6.4 if it was not done automatically
sudo python_select python26
or
sudo python_select python25
When you have selected python26 all add-ons will be installed for
python26 and if you switch back to the apple version of python (or any
other python version) the add-ons will need to be reinstalled in order
to work with that version of python.
Then install gcc ( I selected 4.3) It takes a few hours.
This can also be done from Macports
also install gfortran and f2c from Macports
Then install tkinter - it is needed for gui's
If you have Python25 you can install it from Macports
otherwise
http://wiki.python.org/moin/TkInter
Then you need to install numpy, numarray and numeric.
You can find this from Macports as well.
You might as well install graphviz as well from macports.
Finaly I also installed matplotlib since that is used by the reactor
example:
http://matplotlib.sourceforge.net/
Sundials:
Download the version 2.4.0
I tested with version 2.3 and I got some strange errors... Not sure
what it was
https://computation.llnl.gov/casc/sundials/main.html
To install you do the following:
cd sundials
mkdir BUILD
cd BUILD
../configure --prefix=path_to_install --enable-examples CC=gcc
F77=gfortran --with-cflags='-g3 -O2 -fPIC' --with-fflags='-g3 -O0
-fPIC' --disable-mpi
(The path_to_install can be e.g. /opt/sundials-2.4/)
make
make install
(I edited the version of this info from this page:)
(ref:
http://groups.google.com/group/cantera-users/browse_thread/thread/01843d5e90924cb3)
Edit you .bash_profile
(you find it in your home dir... e.g. open -e .bash_profile)
I am not 100% sure about what needs to be in here but I added:
SUNDIALS_HOME=/opt/sundials-2.4/:
YLD_LIBRARY_PATH=/opt/sundials-2.4/lib:
Then save the file and source it so cantera finds the changes
->source .bash_profile
Cantera:
I downloaded version 266 from SVN
Open the preconfig script and change python to FULL install
I also added the path to Sundials
/opt/sundials-2.4/
(Assuming you used the same path as I did)
When you run the preconfig script make sure it finds the sundials
installation. It comes in the first 20 or 30 lines of the output
If the script do not find Sundials - check the paths.
If the preconfig works
make
sudo make install
Then edit your .bash_profile file again.
I had some issues so I added all the paths in my PYTHONPATH:
Here is my version:
PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/
Current/:/opt/local/Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/site-packages/:/opt/local/Library/Frameworks/
Python.framework/Versions/2.6/lib/python2.6/site-packages/Cantera:/opt/
local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
site-packages/MixMaster:/opt/local/Library/Frameworks/Python.framework/
Versions/Current/bin:/opt/local/bin/python:/Applications/Cantera/:/
Applications/Cantera/bin:
Then add the config script for cantera to the .bash_profiel
Add the line:
source setup_cantera
close the file and
source .bash_profile
Now it should work.