Anders Andreasen Blog

Just another WordPress.com weblog

Installing cantera 1.8 on Ubuntu 9.10 (32 bit)

with 35 comments

Note: I just checked that the procedure (svn) given below also works for Ubuntu 10.10, and it does.

Here’s a brief description on how I managed to compile and install cantera 1.8 on Ubuntu 9.10 (32 bit), with the full python interface. However, first a little description of what cantera is (taken from the website):

Cantera is a suite of object-oriented software tools for problems involving chemical kinetics, thermodynamics, and/or transport processes.

Cantera is written in C++, and can be interfaced also from python, matlab and Fortran.

  1. First step is to install any dependencies. This is handled by apt-get:
    sudo apt-get install subversion g++ gfortran python2.6-dev python-numpy libsundials* graphviz
  2. Next step is to get the source for cantera. This can be done by either downloading the cantera-1.8.0-beta-tar.gz from the cantera site our checking the latest version from svn
    svn checkout http://cantera.googlecode.com/svn/cantera18/trunk/ cantera
  3. change to the cantera directory (either the svn checkout or the untarred/gunzipped cantera-1.8.0)
  4. Edit the file named preconfig and make sure the following lines are included by uncommenting/editing
    PYTHON_PACKAGE=${PYTHON_PACKAGE:="full"}
    USE_NUMPY=${USE_NUMPY:="y"}
    SUNDIALS_VERSION=${SUNDIALS_VERSION:='2.3'}
  5. The entire preconfig file can be viewed here
  6. then in a terminal run the following commands
    ./preconfig
    make
    sudo make install
    source ~/setup_cantera
  7. If everything went well you should be able to import the Cantera module in python:
    python
    >>>from Cantera import *
Advertisements

Written by aandreasen

January 28, 2010 at 11:06 pm

35 Responses

Subscribe to comments with RSS.

  1. That’s exactly I was looking for. It works for me. Thank you.

    Rodolfo

    January 30, 2010 at 12:50 pm

    • Thanks. Good to hear.

      aandreasen

      January 30, 2010 at 4:15 pm

  2. Great info, one thing to note. The G++ compiler isn’t installed by default on Ubuntu 9.10 so if you get the message that the compiler cannot make executables, make sure you have the G++ package installed.

    J. Anthony Smith

    February 23, 2010 at 9:20 pm

    • Thanks, g++ was probably installed as a dependency from some other package installed previously. I’ll update the post accordingly.

      aandreasen

      February 23, 2010 at 10:29 pm

  3. Thank you very much for this tutorial.

    I’ve just tested it on a fresh new Ubuntu 10.04.
    It worked perfectly, except the “svn checkout …” command line that requires a “sudo apt-get install subversion” before.

    Stéphane

    May 9, 2010 at 7:07 am

    • Thanks for the info. I’ve added the subversion package in the post.

      aandreasen

      May 9, 2010 at 2:35 pm

  4. Hi, your instructions are exactly what I was looking for but I’ve got some problems…I’ve changed the preconfig and followed your instructions but when I did “make” at the end I’ve found these error messages:
    In file included from CVodesIntegrator.cpp:37:
    /usr/include/cvodes/cvodes_band.h:161: error: ‘BandMat’ has not been declared
    /usr/include/cvodes/cvodes_band.h:269: error: ‘BandMat’ has not been declared
    make[2]: *** [CVodesIntegrator.o] Error 1
    make[2]: Leaving directory `/home/francescargheric/cantera/Cantera/src/numerics’
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/francescargheric/cantera/Cantera/src’
    make: *** [kernel] Error 2

    and then when I did “sudo make install” these others one:

    make[1]: Entering directory `/home/francescargheric/cantera/Cantera/clib/src’
    /usr/bin/install -c -d /usr/local/cantera/lib
    /usr/bin/install -c -c -m 644 /home/francescargheric/cantera/build/lib/i686-pc-linux-gnu/libclib.a /usr/local/cantera/lib
    /usr/bin/install: cannot stat `/home/francescargheric/cantera/build/lib/i686-pc-linux-gnu/libclib.a’: No such file or directory
    make[1]: *** [install] Error 1
    make[1]: Leaving directory `/home/francescargheric/cantera/Cantera/clib/src’
    make: *** [clib-install] Error 2

    so after these errors it can find the
    source ~/setup_cantera
    bash: /home/francescargheric/setup_cantera: No such file or directory..

    Sorry it’s my first time I try to install something on linux and I don’t have any expertise…Could you help me?

    Francesca

    January 26, 2011 at 11:08 am

  5. *sorry, after these errors it CAN’T find

    Francesca

    January 26, 2011 at 11:16 am

  6. Hi Francesca

    Are you using sundials? If so which version? and is this declared in the preconfig?
    Anyway which OS?

    Kind regards

    Anders

    Anders Andreasen

    January 27, 2011 at 7:47 pm

    • Uhm good question…I thought that the command with “apt-get” would allowed to download the sundials…actually I think I’ve only the package “cvode” because I should use it for another program (FlameMaster that gives to me anyway some problems)…btw, I think I don’t have sundials..could you suggest me how download these?
      For the second question, like a stupid, I left anyway the declaration in the preconfig like read in your example (so it’s declared “sundials 2.3”);
      last question…I use linux, in particular ubuntu release 9.10 32 bit.
      Thanks for all
      Francesca

      Francesca

      January 28, 2011 at 2:00 pm

  7. Can you send your preconfig?

    aandreasen

    January 29, 2011 at 9:38 pm

  8. Can u give me your e-mail adress to send my preconfig?

    Francesca

    January 30, 2011 at 8:59 am

  9. Of course thanks for your kindness!

    Francesca

    January 30, 2011 at 9:01 am

  10. Waitwaitwait…I’ve downloaded the sundials 2.3 and now no errors but once I’ve written source etc (I’ve activated the program in this way I think, If I make errors please tell me) what should I do?
    Tnx

    Francesca

    Francesca

    January 30, 2011 at 9:28 am

  11. This is my last shell

    Cantera has been successfully installed.

    File locations:

    applications /usr/local/cantera/bin
    library files /usr/local/cantera/lib
    C++ headers /usr/local/cantera/include/cantera
    demos /usr/local/cantera/demos
    data files /usr/local/cantera/data

    Python package /usr/local/lib/python2.6/dist-packages/Cantera

    setup script /home/francescargheric/setup_cantera

    The setup script configures the environment for Cantera. It is
    recommended that you run this script by typing

    source /home/francescargheric/setup_cantera

    before using Cantera, or else
    include its contents in your shell login script.

    cp -f “/home/francescargheric/setup_cantera” “/usr/local/cantera/bin”
    chmod +x /usr/local/cantera/bin/setup_cantera
    chmod +x /usr/local/cantera/bin/ctnew
    chmod +x /usr/local/cantera/bin/mixmaster
    francescargheric@francescargheric-laptop:~/cantera$ source ~/setup_cantera

    Francesca

    January 30, 2011 at 9:30 am

  12. I was arrived to the point “source/home/francescargheric/setup_cantera” but I don’t understand if I’ve to do the last instructions and after all I tried to type the command “cp -f” but the result is
    cp -f /home/francescargheric/setup_cantera /usr/local/cantera/bin
    cp: cannot remove `/usr/local/cantera/bin/setup_cantera’: Permission denied
    …What I’ve to do?
    Sorry for the billion of messages…sorrysorrysorry!

    Francesca

    January 30, 2011 at 9:35 am

    • I think if this works, it should be ok.

      chmod +x /usr/local/cantera/bin/setup_cantera
      chmod +x /usr/local/cantera/bin/ctnew
      chmod +x /usr/local/cantera/bin/mixmaster

      How are you intending to use Cantera? From python? If so you should try the following:

      from the command line start python

      python

      in python import the Cantera module

      >>> from Cantera import *
      >>> gas = GRI30()

      If you don’t get any error messages everything should be fine: Hope it works out.

      aandreasen

      January 30, 2011 at 10:08 am

  13. I’ve tried to type these commands but I find this error message

    francescargheric@francescargheric-laptop:~$ chmod +x /usr/local/cantera/bin/setup_cantera
    chmod: changing permissions of `/usr/local/cantera/bin/setup_cantera’: Operation not permitted

    Why?
    Anyway I think I’m arriving to the result..

    Francesca

    January 30, 2011 at 4:23 pm

  14. Last question, I tried also to write the commands you suggest and when I wrote “gas= GRI30()” this message appeared

    sh: source: not found

    So this is the situation, I’ve problems with the “chmod” instructions and with the last instruction…So what I’ve to do now?

    Francesca

    January 30, 2011 at 4:31 pm

  15. Wait, I think I’ve to write always the instruction “source” when I open new shells, isn’t it?

    because I tried and then no errors…so, if there’s something wrong in my path just tell me, otherwise I’ll wait to start using it and then I’ll contact you again for any suggests.
    Mr. Andres Andreasen thanks a lot for your patience!
    Francesca

    Francesca

    January 30, 2011 at 4:36 pm

  16. Hi, sorry but I’m here again…no, just kidding. There’s a friend of mine who has to install Cantera on Win but he doesn’t find the right package…Could you help us?

    Best regards

    Francesca

    March 15, 2011 at 12:16 pm

  17. Nothing to say..just thank you!

    Francesca

    March 16, 2011 at 1:01 pm

  18. I have read the tutorial but i have found a problem. When i try to create the nasa_gas.xml file with a Python prompt:
    import Cantera, os
    os.chdir(‘c:/Program Files/cantera/data’)
    Cantera.Solution(‘nasa_gas.cti’)
    there is the following Cantera Error:
    Procedure: ct2ctml
    Error: could not convert input file to CTML
    Command line was:
    C:\Python|python.exe “C:Users\Luigi|AppData\Local\Temp/.cttmp1300358677.pyw”
    C:\Python|python.exe C:Users\Luigi|AppData\Local\Temp/ct2ctml.log
    The log file is the following:
    Traceback (most recent call last):
    File “C:\Users\Luigi\AppData\Local\Temp/.cttmp1300358677.pyw”, line 8, in
    write()
    File “C:\Python26\lib\site-packages\ctml_writer.py”, line 303, in write
    x.write(_name+’.xml’)
    File “C:\Python26\lib\site-packages\ctml_writer.py”, line 126, in write
    f = open(file,’w’)
    IOError: [Errno 13] Permission denied: ‘nasa_gas.xml’
    I hope you can help me
    Best Regards
    Luigi

    Luigi

    March 17, 2011 at 11:20 am

  19. […] guide for Linux: aandreasen.wordpress.com/2010/01/28/installing-cantera-1–8-on-ubuntu-9–10-32-bit (This is a tuto­r­ial for instal­la­tion on Ubuntu 9.10 32-bit but it could be use for other […]

    Cantera | ChENGINEER SPACE

    August 11, 2011 at 2:31 am

  20. Thanks to your directions, I just installed Cantera-1.8 on my Debian Wheezy system. I had to put 2.3 of sundial on, and modify the preconfig somewhat, but your description was an enormous help. Thank you.

    John

    September 3, 2011 at 4:31 am

  21. Your post was super helpful for getting cantera up and running. Thanks.

    Chad

    November 17, 2011 at 8:47 pm

  22. […] the Cantera as a python module within Ubuntu linux. For reference I used these instructions: Installing Cantera. After running ./preconfig and make, I get the following […]

  23. What about 11.10???

    I went through everything and got to this:

    src/pycantera.cpp:16:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command ‘g++’ failed with exit status 1
    make[1]: *** [_build] Error 1
    make[1]: Leaving directory `/home/colin/cantera/Cantera/python’
    make: *** [python] Error 2

    any help would be greatly appreciated. Thanks, Colin

    Colin

    November 19, 2011 at 4:04 am

  24. Hi

    I’m trying to install Cantera 1.8 in Ubuntu 11.10 following your instructions. I installed python 2.6 and 2.7 and tried make with both and it didn’t work. This is what I’m getting (those are the lines I believe the error is associated with):

    cd Cantera/python; make
    make[1]: Entering directory `/home/ohdiaz/cantera/Cantera/python’
    touch src/pycantera.cpp
    /bin/rm -f _build
    (CXX=”g++”; export CXX; CC=”g++”; export CC; CFLAGS=”-O3 -Wall -fPIC”; export CFLAGS; PURIFY=””; export PURIFY; /usr/lib/python2.7 setup.py build)
    /bin/sh: /usr/lib/python2.7: Permission denied
    make[1]: *** [_build] Error 126
    make[1]: Leaving directory `/home/ohdiaz/cantera/Cantera/python’
    make: *** [python] Error 2

    Any ideas? I will appreciate your help!

    Thank you!

    Oscar Diaz

    March 19, 2012 at 3:51 am

    • Did you install the python 2.7 development package: python2.6-dev via apt?

      aandreasen

      April 26, 2012 at 1:00 pm

      • I meant python2.7-dev 😉

        aandreasen

        April 26, 2012 at 1:04 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: