<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>guys like dolls &#187; macosx</title>
	<atom:link href="http://guyslikedolls.com/category/macosx/feed/" rel="self" type="application/rss+xml" />
	<link>http://guyslikedolls.com</link>
	<description>an exploration of something</description>
	<lastBuildDate>Tue, 06 Jul 2010 23:21:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Install Cantera on Mac OS X</title>
		<link>http://guyslikedolls.com/2007/03/01/install-cantera-on-mac-os-x/</link>
		<comments>http://guyslikedolls.com/2007/03/01/install-cantera-on-mac-os-x/#comments</comments>
		<pubDate>Thu, 01 Mar 2007 19:18:10 +0000</pubDate>
		<dc:creator>jcdoll</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Cantera is a suite of object-oriented software tools for problems involving chemical kinetics, thermodynamics, and/or transport processes. It can be used from MATLAB, Python, C++, or Fortran. I used it for ME 140 (Combustion Engineering) at UC Berkeley in Fall 2005 to calculate things like adiabatic flame temperatures and equilibrium states for homework problems. There [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cantera.org">Cantera</a> is a suite of object-oriented software tools for problems involving chemical kinetics, thermodynamics, and/or transport processes. It can be used from MATLAB, Python, C++, or Fortran. I used it for ME 140 (Combustion Engineering) at UC Berkeley in Fall 2005 to calculate things like adiabatic flame temperatures and equilibrium states for homework problems.</p>
<p>There isn&#8217;t any documentation for installing Cantera on Mac OS X, and although it should be straight forward I encountered some problems and I want to try to fill that documentation void. Cantera is incredibly powerful software and the creator (Dave Goodwin) is helpful and active on the official <a href="http://groups.yahoo.com/group/cantera/">newsgroup</a>.</p>
<h4>My Settings</h4>
<p>My system specifications are:<br />
* Mac OS X 10.4.2<br />
* XCode 2.0 developer tools (current version as of 9/13/05)<br />
* Matlab 7 (R14)<br />
* Cantera installed using the 1.6.0 binary release from [http://sourceforge.net/projects/cantera/ Sourceforge] in the files section.</p>
<h4>The Symptoms</h4>
<p>I could not run the Cantera examples from Python or Matlab and was encountering the following types of errors:<br />
<code><br />
&gt;&gt; run_examples<br />
EQUIL a chemical equilibrium example.</p>
<p>This example computes the adiabatic flame temperature and<br />
equilibrium composition for a methane/air mixture as a function of<br />
equivalence ratio.</p>
<p>Traceback (most recent call last):<br />
File "./.cttmp1125719147.pyw", line 1, in ?<br />
from ctml_writer import *<br />
ImportError: No module named ctml_writer<br />
???</p>
<p>Cantera Error!</p>
<p>Procedure: ct2ctml<br />
Error: could not convert input file to CTML.<br />
Command line was:<br />
sleep 1; python ./.cttmp1125719147.pyw &amp;&gt; ct2ctml.log</p>
<p>Error in ==&gt; XML_Node.XML_Node at 11<br />
x.id = ctmethods(10,15,0,src); % newxml(name)</p>
<p>Error in ==&gt; Solution.Solution at 30<br />
doc = XML_Node('doc',src);</p>
<p>Error in ==&gt; IdealGasMix at 39<br />
s = Solution(a);</p>
<p>Error in ==&gt; equil at 12<br />
gas = IdealGasMix('gri30.cti');</p>
<p>Error in ==&gt; run_examples at 3<br />
equil(0);</code><br />
and from within Python<br />
<code><br />
-----:/Applications/Cantera/demos/python/flames -----$ python flame1.py<br />
Traceback (most recent call last):<br />
File "flame1.py", line 7, in ?<br />
from Cantera import *<br />
ImportError: No module named Cantera</code></p>
<h4>The Fix</h4>
<p>The error messages indicate that Python is not aware of the Cantera module. After some thought and googling I decided that I should check what directories Python is searching for its modules. The PYTHONPATH environment variable can be printed by importing sys and printing sys.path.<br />
<code><br />
-----:/Applications/Cantera/demos/python/flames -----$ python<br />
Python 2.3.5 (#1, Mar 20 2005, 20:38:20)<br />
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin<br />
Type "help", "copyright", "credits" or "license" for more information.<br />
&gt;&gt;&gt; import sys<br />
&gt;&gt;&gt; print sys.path<br />
['', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip',<br />
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3',<br />
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin',<br />
 '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac',<br />
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages',<br />
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk',<br />
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload',<br />
 '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages',<br />
 '/System/Library/Frameworks/Python.framework/Versions/2.3/Extras/lib/python']</code></p>
<p>As you can see above, the /Libary/Python/2.3/ (or, optionally I think, the /Applications/Cantera/bin/) directory are not being searched for modules, and it happens that the Cantera files are located in those directories. In order to search additional directories you can create .pth files in the current search path to add additional directories to the search path. There is a file called Extras.pth in the /Library/Python/2.3/site-packages/ directory which will do just this task and it&#8217;s a simple task to add our new directories.</p>
<p>Open the Extras.pth file from the command line:<br />
<code>emacs /Library/Python/2.3/site-packages/Extras.pth</code><br />
Edit it so that it looks like this:<br />
<code><br />
/System/Library/Frameworks/Python.framework/Versions/2.3/Extras/lib/python<br />
/Library/Python/2.3/</code><br />
And then save and close it with Control-X Control-S and Control-X Control-C</p>
]]></content:encoded>
			<wfw:commentRss>http://guyslikedolls.com/2007/03/01/install-cantera-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
