I'm attempting to install 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 error:
fatal error: numarray/arrayobject.h: No such file or directory
According to the preconfig file,
# If numpy was installed using the --home option, set this to the
# home directory for numpy. This will be needed for all numpy installations
# that don't put the include files into python's native include directory.
#NUMPY_HOME=${NUMPY_HOME:="$HOME/python_packages"}
and I'm using the student version of Enthought Python Distribution so I thought maybe I need to change the last line to:
NUMPY_HOME=${NUMPY_HOME:="/usr/local/EPD/lib/python2.7/site-packages/"}
but this is not working. I still get the same error. Thoughts? I've installed python-dev to fix an earlier bug so that's not it.
I found a fix. By following these instructions that I had previously followed, I got it to work. The difference is that the last time, I downloaded the tar.gz file, and this time, I used the subversion repository, which might be more updated I guess. Anyway, it worked, and I did not need to change the default python command either.
Edit: I did need to change this from the default to:
PYTHON_CMD=${PYTHON_CMD:="/usr/local/EPD/bin/python"}
I guess it's a good idea to also post the instructions so they're available here for other users:
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
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
Change to the cantera directory (either the svn checkout or the untarred/gunzipped cantera-1.8.0)
Edit the file named preconfig and make sure the following lines are included by commenting/editing
PYTHON_PACKAGE=${PYTHON_PACKAGE:="full"}
USE_NUMPY=${USE_NUMPY:="y"}
SUNDIALS_VERSION=${SUNDIALS_VERSION:='2.3'}
Then in a terminal run the following commands:
./preconfig
make
sudo make install
source ~/setup_cantera
If every thing went well you should be able to import the Cantera module in python:
python
>>>from Cantera import *