Prev Next install

@(@\newcommand{\B}[1]{{\bf #1}} \newcommand{\R}[1]{{\rm #1}}@)@
Installing pycppad

Other Instructions
If you are using WinPython , see building pycppad in Windows

Requires
This package requires the following other packages:
  1. The Boost Python (development version) must be installed.
  2. The python numpy library must be installed.
  3. The CppAD package.


Downloading
Download the file pycppad-20140710.tar.gz and store it on your machine.

Unpacking
On unix, you could use the command
 
     tar -xvzf  pycppad-20140710.tar.gz
which would create the directory pycppad-20140710.

Required Setup Information
The value of the following setup variables, in the file
 
     pycppad-20140710/setup.py
must be set to agree with your system:
 
     # Directory where CppAD include files are located
     # cppad_include_dir        = [ '/usr/include' ]
     cppad_include_dir        = [ os.environ['HOME'] + '/prefix/cppad/include' ]
     #
     # Directory where Boost Python include files are located
     boost_python_include_dir = [ '/usr/include' ]
     #
     # Director whre Boost Python library is located
     # boost_python_lib_dir     = [ '/usr/lib' ] 
     boost_python_lib_dir     = [ '/usr/lib64' ] 
     #
     # Name of the Boost Python library in boost_python_lib_dir.
     # boost_python_lib         = [ 'boost_python-mt' ]
     boost_python_lib         = [ 'boost_python' ]
Note that Boost Python and CppAD must be installed before you can properly set this information.

Building

With Debugging
Change into the directory pycppad-20140710 and execute the command
 
     ./setup.py build_ext --inplace --debug --undef NDEBUG
to compile and link a version of the CppAD extension module with debugging (improved error messaging).

Optimized
You can compile and link an optimized version of the CppAD extension module with the command
 
     ./setup.py build_ext --inplace
Note that in the optimized version, certain error checking is not done and improper use of pycppad.cpp may lead to a segmentation fault.

Bug in Python Distutils
When using the GNU C++ compiler gcc, the warning
 
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
will be printed. This is not requested by setup.py but is rather a bug in the Python distutils package.

Cygwin
If python crashes during the build procedure under cygwin, you may need to run the rebaseall program. For example, execute the following steps:
  1. Check which cygwin processes are running using the ps -e command, and shut them all down.
  2. Open an DOS command window, for example, select Start | Run and then enter cmd in as the program to run.
  3. Change into the cygwin bin directory. If you installed cygwin in the default location, the following command will do this:
     
         cd c:\cygwin\bin
    
  4. Start the ash shell by executing the command
     
         ash.exe
    
  5. The execute the command
     
         /usr/bin/rebaseall
    
    This will take a few minutes to execute. When it is done, you can close the command window by executing the command exit twice.


Testing
You can test of all the examples in the pycppad documentation. Change into the directory pycppad-20140710 and execute the command
 
     python test_example.py
You can run some more tests with the command
     python test_more.py 
with_debugging
where with_debugging is True or False depending on if you built with debugging .

Error
If you get a message about cppad_ being missing, it is probably because you did not use the --inplace flag when you built pycppad.

Installing
Installing pycppad copies it to the standard location for you system. You may or may not preform this step:

Change into the directory pycppad-20140710 and execute the command
     ./setup.py build_ext --debug --undef NDEBUG install --prefix=
prefix
or
     ./setup.py build_ext install --prefix=
prefix
where prefix is the prefix for the location where you wish to install pycppad. Note that some common choices for prefix are
$HOME if you are not the system administrator for this machine
/usr/local you're administrator and the system has a package manager (like yum, apt-get).
/usr you're the administrator but the system does not have a package manager.

Uninstalling
Unfortunately, python's distutils package does not provide an uninstall command. You can uninstall the pycppad package by removing the entries
     
prefix/lib/pythonmajor.minor/site-packages/pycppad
     
prefix/lib/pythonmajor.minor/site-packages/pycppad-20140710.egg-info
     
prefix/share/doc/pycppad
where major and minor are the major and minor version numbers printed by the command
 
     python --version

Python Path
If you have not installed pycppad, you will not be able to use the python command
     import pycppad
unless the distribution directory
 
     pycppad-20140710
is in your python path. If you have installed pycppad, the installation directory
     
prefix/lib/pythonmajor.minor/site-packages
must be in you python path (to use the import pycppad command). You can check your python path with the following commands
 
     python
     import sys
     sys.path
If the required directory is not yet there, you could add the directory above to your python path using the command
     sys.path.append('
prefix/lib/pythonmajor.minor/site-packages')
You can avoid having to do this every time you load python by adding the path to your environment variable PYTHONPATH. For example, if you are using the bash shell, you could add the command
     export PYTHONPATH="
prefix/lib/pythonmajor.minor/site-packages"
to your $HOME/.bashrc file.

pycppad Documentation
The documentation for pycppad starts out in the directory
 
     pycppad-20140710/doc
During the installation process, it is copied to the directory
     
prefix/share/doc/pycppad

Input File: omh/install.omh