<?xml version='1.0'?>
<?xml-stylesheet type='text/xsl' href='pmathml.xsl'?>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Installing pycppad</title>
<meta name="description" id="description" content="Installing pycppad"/>
<link rel='icon' type='image/png' href='_favicon.png'/>
<meta name="keywords" id="keywords" content=" install pycppad download unpack extract build debugging optimize bug python distutils test path "/>
<style type='text/css'>
body { color : black }
body { background-color : white }
A:link { color : blue }
A:visited { color : purple }
A:active { color : purple }
</style>
<script type='text/javascript' language='JavaScript' src='_install_xml.js'>
</script>
</head>
<body>
<table><tr>
<td>
<a href="../home.htm" target="_top"><img border="0" src="_image.gif"/></a>
</td>
<td><a href="_contents_xml.htm" target="_top">Prev</a>
</td><td><a href="get_started.py.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</option>
<option>contents</option>
<option>reference</option>
<option>index</option>
<option>search</option>
<option>external</option>
</select>
</td>
<td>
<select onchange='choose_up0(this)'>
<option>Up-&gt;</option>
<option>pycppad</option>
<option>install</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>pycppad-&gt;</option>
<option>install</option>
<option>get_started.py</option>
<option>example</option>
<option>ad_variable</option>
<option>ad_function</option>
<option>two_levels.py</option>
<option>runge_kutta_4</option>
<option>whats_new_10</option>
<option>license</option>
</select>
</td>
<td>install</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Requires</option>
<option>Downloading</option>
<option>Unpacking</option>
<option>Required Setup Information</option>
<option>Building</option>
<option>---..With Debugging</option>
<option>---..Optimized</option>
<option>---..Bug in Python Distutils</option>
<option>Testing</option>
<option>Installing</option>
<option>---..Uninstalling</option>
<option>Python Path</option>
<option>pycppad Documentation</option>
</select>
</td>
</tr></table><br/>
<center><b><big><big>Installing pycppad</big></big></b></center>
<br/>
<b><big><a name="Requires" id="Requires">Requires</a></big></b>
<br/>
This package requires the following other packages:

<ol type="1"><li>
The Boost Python (development version) must be installed.
</li><li>

The python numpy library must be installed.
</li><li>

The CppAD package will be automatically downloaded and used
(but not installed).
</li></ol>


<br/>
<br/>
<b><big><a name="Downloading" id="Downloading">Downloading</a></big></b>


<br/>
Download the file
<a href="http://www.seanet.com/~bradbell/pycppad-20100319.tar.gz" target="_top"><span style='white-space: nowrap'>pycppad-20100319.tar.gz</span></a>

and store it on your machine.

<br/>
<br/>
<b><big><a name="Unpacking" id="Unpacking">Unpacking</a></big></b>




<br/>
On unix, you could use the command
<code><font color='blue'><pre style='display:inline'> 
	tar -xvzf  pycppad-20100319.tar.gz
</pre></font></code>

which would create the directory <code><font color="blue">pycppad-20100319</font></code>.

<br/>
<br/>
<b><big><a name="Required Setup Information" id="Required Setup Information">Required Setup Information</a></big></b>
<br/>
The value of the following setup variables, in the file
<code><font color='blue'><pre style='display:inline'> 
	pycppad-20100319/setup.py
</pre></font></code>

must be set to agree with your system:
<code><font color="blue">
<pre style='display:inline'> 
     # Directory where Boost Python library is located
     boost_python_lib_dir = '/usr/lib' 
     # The name of the Boost Python library in that directory which must
     # begin with 'lib' and end with '.so'.
     boost_python_lib_name  = 'libboost_python.so' 
     # The CppAD tarball will be downloaded into this directory
     # and it will be extraced to a subdirectory called  cppad-* or CppAD-*
     cppad_parent_dir = os.environ.get('HOME') + '/install'
     # 
</pre>

</font></code>
Note that Boost Python must be installed before you can
properly set this information
(but CppAD need not be installed).

<br/>
<br/>
<b><big><a name="Building" id="Building">Building</a></big></b>




<br/>
<br/>
<b><a name="Building.With Debugging" id="Building.With Debugging">With Debugging</a></b>


<br/>
Change into the directory <code><font color="blue">pycppad-20100319</font></code> and execute the command
<code><font color='blue'><pre style='display:inline'> 
	./setup.py build_ext --inplace --debug --undef NDEBUG
</pre></font></code>

to compile and link a version of the CppAD extension module
with debugging (improved error messaging).

<br/>
<br/>
<b><a name="Building.Optimized" id="Building.Optimized">Optimized</a></b>


<br/>
You can compile and link an optimized version of the CppAD extension
module with the command
<code><font color='blue'><pre style='display:inline'> 
	./setup.py build_ext --inplace
</pre></font></code>

Note that in the optimized version, certain error checking is not
done and improper use of <code><font color="blue">pycppad.cpp</font></code> may lead to a segmentation fault.

<br/>
<br/>
<b><a name="Building.Bug in Python Distutils" id="Building.Bug in Python Distutils">Bug in Python Distutils</a></b>



<br/>
When using the GNU C++ compiler <code><font color="blue">gcc</font></code>, the warning 
<code><font color='blue'><pre style='display:inline'> 
cc1plus: warning: command line option &quot;-Wstrict-prototypes&quot; is valid for Ada/C/ObjC but not for C++
</pre></font></code>

will be printed. 
This is not requested by <code><font color="blue">setup.py</font></code> but is rather a bug
in the Python 
<a href="http://docs.python.org/distutils/" target="_top"><span style='white-space: nowrap'>distutils</span></a>

package.

<br/>
<br/>
<b><big><a name="Testing" id="Testing">Testing</a></big></b>


<br/>
You can test of all the 
<a href="example.xml" target="_top"><span style='white-space: nowrap'>examples</span></a>
 in the <code><font color="blue">pycppad</font></code> documentation.
Change into the directory <code><font color="blue">pycppad-20100319</font></code> and execute the command
<code><font color='blue'><pre style='display:inline'> 
	python test_example.py
</pre></font></code>

You can run some more tests with the command
<code><font color='blue'><pre style='display:inline'> 
	python test_more.py
</pre></font></code>


<br/>
<br/>
<b><big><a name="Installing" id="Installing">Installing</a></big></b>


<br/>
Installing <code><font color="blue">pycppad</font></code> copies it to the standard location for you system.
You may or may not preform this step:
<code><span style='white-space: nowrap'><br/>
<br/>
</span></code>Change into the directory <code><font color="blue">pycppad-20100319</font></code> and execute the command

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;python&#xA0;setup.py&#xA0;install&#xA0;--prefix=</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
or just

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;./setup.py&#xA0;install&#xA0;--prefix=</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
where 
<code><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i></code>
 is the prefix for the location
where  you wish to install <code><font color="blue">pycppad</font></code>.
Note that some common choices for 
<code><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i></code>
 are
<table><tr><td align='left'  valign='top'>

<code><font color="blue">$HOME</font></code> </td><td align='left'  valign='top'>
 if you are not the system administrator for this machine 
</td></tr><tr><td align='left'  valign='top'>

<code><font color="blue">/usr/local</font></code> </td><td align='left'  valign='top'>
 you're administrator and the system
has a package manager (like <code><font color="blue">yum</font></code>, <code><font color="blue">apt-get</font></code>). 
</td></tr><tr><td align='left'  valign='top'>

<code><font color="blue">/usr</font></code>       </td><td align='left'  valign='top'>
 you're the administrator but the system does not
have a package manager.
</td></tr>
</table>
<br/>
<b><a name="Installing.Uninstalling" id="Installing.Uninstalling">Uninstalling</a></b>
<br/>
Unfortunately, python's <code><font color="blue">distutils</font></code> package does not provide
an uninstall command. You can uninstall the <code><font color="blue">pycppad</font></code> package
by removing the entries

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'>/lib/python</span></font><i><font color="black"><span style='white-space: nowrap'>major</span></font></i><font color="blue"><span style='white-space: nowrap'>.</span></font><i><font color="black"><span style='white-space: nowrap'>minor</span></font></i><font color="blue"><span style='white-space: nowrap'>/site-packages/pycppad<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'>/lib/python</span></font><i><font color="black"><span style='white-space: nowrap'>major</span></font></i><font color="blue"><span style='white-space: nowrap'>.</span></font><i><font color="black"><span style='white-space: nowrap'>minor</span></font></i><font color="blue"><span style='white-space: nowrap'>/site-packages/pycppad-20100319.egg-info<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'>/share/doc/pycppad<br/>
</span></font></code>
where 
<code><i><font color="black"><span style='white-space: nowrap'>major</span></font></i></code>
 and 
<code><i><font color="black"><span style='white-space: nowrap'>minor</span></font></i></code>

are the major and minor version numbers printed by the command
<code><font color='blue'><pre style='display:inline'> 
	python --version
</pre></font></code>


<br/>
<br/>
<b><big><a name="Python Path" id="Python Path">Python Path</a></big></b>


<br/>
If you have not installed <code><font color="blue">pycppad</font></code>,
you will not be able to use the python command

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;import&#xA0;pycppad<br/>
</span></font></code>
unless the distribution directory
<code><font color='blue'><pre style='display:inline'> 
	pycppad-20100319
</pre></font></code>

is in your python path.
If you have installed <code><font color="blue">pycppad</font></code>,
the installation directory

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'>/lib/python</span></font><i><font color="black"><span style='white-space: nowrap'>major</span></font></i><font color="blue"><span style='white-space: nowrap'>.</span></font><i><font color="black"><span style='white-space: nowrap'>minor</span></font></i><font color="blue"><span style='white-space: nowrap'>/site-packages<br/>
</span></font></code>
must be in you python path (to use the <code><font color="blue">import pycppad</font></code> command).
You can check your python path with the following commands
<code><font color='blue'><pre style='display:inline'> 
	python
	import sys
	sys.path
</pre></font></code>

If the required directory is not yet there,
you could add the directory above to your python path using the command

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;sys.path.append('</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'>/lib/python</span></font><i><font color="black"><span style='white-space: nowrap'>major</span></font></i><font color="blue"><span style='white-space: nowrap'>.</span></font><i><font color="black"><span style='white-space: nowrap'>minor</span></font></i><font color="blue"><span style='white-space: nowrap'>/site-packages')<br/>
</span></font></code>
You can avoid having to do this every time you load python by adding
the path to your environment variable <code><font color="blue">PYTHONPATH</font></code>.
For example, if you are using the <code><font color="blue">bash</font></code> shell, you could
add the command

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;export&#xA0;PYTHONPATH=&quot;</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'>/lib/python</span></font><i><font color="black"><span style='white-space: nowrap'>major</span></font></i><font color="blue"><span style='white-space: nowrap'>.</span></font><i><font color="black"><span style='white-space: nowrap'>minor</span></font></i><font color="blue"><span style='white-space: nowrap'>/site-packages&quot;<br/>
</span></font></code>
to your <code><font color="blue">$HOME/.bashrc</font></code> file.

<br/>
<br/>
<b><big><a name="pycppad Documentation" id="pycppad Documentation">pycppad Documentation</a></big></b>
<br/>
The documentation for <code><font color="blue">pycppad</font></code> starts out in the directory
<code><font color='blue'><pre style='display:inline'> 
	pycppad-20100319/doc
</pre></font></code>

During the installation process, it is copied to the directory

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>prefix</span></font></i><font color="blue"><span style='white-space: nowrap'>/share/doc/pycppad<br/>
</span></font></code>

<hr/>Input File: omh/install.omh

</body>
</html>
