1. Get and install casiopeia¶
Within the next sections, you will get to know how to obtain and install casiopeia, and what prerequisites have to be met to get casiopeia working correctly.
1.1. Installation on Ubuntu 16.04¶
The following instructions show the installation on Ubuntu 16.04. If you are planning to install casiopeia on Linux systems different from Ubuntu 16.04, these commands need to be adapted accordingly.
1.1.1. Prerequesites¶
1.1.1.1. Python¶
In order to use casiopeia, please make sure that Python (currently supported version is Python 2.7) as well as Python Numpy (>= 1.8), PyLab and Python Setuptools are installed on your system. This can easily be ensured by running
sudo apt-get update
sudo apt-get install python python-numpy python-scipy python-matplotlib python-setuptools --install-recommends
If you want to install casiopeia using pip, which is the recommended and easiest way, you also need to install pip by running
sudo apt-get install python-pip
Also, you might want to install the Spyder IDE for working with Python. You can install it by running
sudo apt-get install spyder
Note
These commands require root privileges. In case you do not have root privileges on your system, consider using Miniconda to install Python and the necessary modules into a user-writeable directory.
1.1.1.2. CasADi¶
For casiopeia to work correctly, you need CasADi version >= 3.1 to be installed on your system. Installation instructions for CasADi can be found here.
Note
Some plugins for CasADi require extra prerequisites to work on Linux. For a list of the required libraries and installation instructions, see the corresponding section in the CasADi installation guide. If something goes wrong with executing CasADi and/or casiopeia, missing one or more of these libraries might be the reason.
In addition to unpacking the archive you just obtained, please make sure that the unpacked folder that contains CasADi can be found by Python permanently. As mentioned in the CasADi installation instructions, this can e. g. be ensured by adding the CasADi directory to the PYTHONPATH
variable permanently. Just open the file ~/.bashrc
on your system with your favorite text editor, and add the line
export PYTHONPATH=$PYTHONPATH:/<path>/<to>/<casadi>/<folder>
while /<path>/<to>/<casadi>/<folder>
needs to be adapted to the path of your unpacked archive. Afterwards, save these changes and close all open terminals. Now open a new terminal, and have a look at the value of PYTHONPATH
by typing
echo $PYTHONPATH
It should now contain at least the path your just inserted. If everything went well, you should be able to open a Python console, and execute the following commands
>>> from casadi import *
>>> x = MX.sym("x")
>>> print jacobian(sin(x),x)
without recieving error messages.
1.1.2. Option 1: Get casiopeia using pip (recommended)¶
1.1.2.1. Installation¶
casiopeia is listed on the Python Package Index. You can obtain it from there by running
sudo pip install casiopeia
If this command fails with a message that CasADi cannot be found on your system, and you installed CasADi by appending it’s directory to PYTHONPATH
via ~/.bashrc
, it’s most likely that your users PYTHONPATH
variable is not available when using sudo
. In this case, try
sudo env PYTHONPATH=$PYTHONPATH pip install casiopeia
Note
These commands require root privileges. In case you do not have root privileges ony your system, consider Option 2: Get casiopeia from GitHub.
1.1.2.2. Upgrades¶
Upgrades to new releases of casiopeia can simply be obtained by running
sudo pip install casiopeia --upgrade
or
sudo env PYTHONPATH=$PYTHONPATH pip install casiopeia --upgrade
respectively.
Note
These commands require root privileges.
1.1.3. Option 2: Get casiopeia from GitHub¶
1.1.3.1. Installation¶
You can also obtain the casiopeia module directly from its GitHub repository. You can either clone the repository, or download the contained files within a compressed archive. To just obtain an archive, you do not need to have git installed, but cloning the repository provides an easy way to receive updates on casiopeia by pulling from the repository.
You can install git by running
sudo apt-get update
sudo apt-get install git
Note
These commands require root privileges. In case you do not have root priviliges and git ist not installed on you system, consider downloading the archive from the GitHub page using your favorite web browser instead of cloning the git repository.
Afterwards, you can clone the repository using the following commands
git clone git@github.com:adbuerger/casiopeia.git
and install casiopeia by running
sudo python setup.py install
from within the casiopeia directory. If this command fails with a message that CasADi cannot be found on your system, and you installed CasADi by appending it’s directory to PYTHONPATH
via ~/.bashrc
, it’s most likely that your users PYTHONPATH
variable is not available when using sudo
. In this case, try
sudo env PYTHONPATH=$PYTHONPATH python setup.py install
Note
These commands require root privileges. In case you do not have root priviliges, consider adding the casiopeia directory to PYTHONPATH
, as described above for CasADi.
1.1.3.2. Upgrades¶
If you recieved casiopeia by cloning the git repository, you can update the contents of your local copy by running
git pull
from within the casiopeia directory. In case you did not clone the repository, you would again need to download a compressed archive.
Afterwards, you need to install the recent version again by running
sudo python setup.py install
or
sudo env PYTHONPATH=$PYTHONPATH python setup.py install
respectively.
Note
These commands require root privileges.
Warning
If you installed casiopeia by adding the directory to PYTHONPATH
, just place the newly obtained files in the previously defined path to upgrade to a new version of casiopeia. You do not not need to add the directory again to PYTHONPATH
then. Also, make sure not to add multiple versions of casiopeia to PYTHONPATH
, since this might lead to conflicts.
1.2. Installation on Windows¶
The following instructions have been tested on Windows 7 64 bit.
Note
You need to have administrator rights on your system to be able to follow the instructions below.
1.2.1. Prerequesites¶
1.2.1.1. Python¶
The easiest way to meet the prerequesites for casiopeia and CasADi on a Windows system might be to install a recent version of Python(x,y), which is also the procedure recommended by the CasADi developers. It is recommended to do a “Full” installation. In the following, the instructions also assume that you are installing Python(x,y) and all components with their default paths.
1.2.1.2. CasADi¶
For casiopeia to work correctly, you need CasADi version >= 3.1 to be installed on your system. Installation instructions for CasADi can be found here.
After unpacking the archive, go to My Computer > Properties > Advanced System Settings > Environment Variables
. If a variable PYTHONPATH
already exists, apply the full path to the CasADi folder to the end of the variable value, and separate this new path from the ones already contained by ;
. If PYTHONPATH
does not yet exist on the system, create a new environmental variable with this name, and fill in the path to the unpacked CasADi folder.
1.2.2. Option 1: Get casiopeia using pip (recommended)¶
1.2.2.1. Installation¶
casiopeia is listed on the Python Package Index. Since you installed pip with Python(x,y), you can obtain casiopeia by opening a command line and running
pip install casiopeia
Note
If you have problems obtaining casiopeia with pip (which can e. g. be caused by a company’s proxy server) consider Option 2: Get casiopeia from GitHub.
1.2.2.2. Upgrades¶
Upgrades to new releases of casiopeia can simply be obtained by running
pip install casiopeia --upgrade
1.2.3. Option 2: Get casiopeia from GitHub¶
1.2.3.1. Installation¶
You can also obtain the casiopeia module directly from its GitHub repository. Since installing git is more time-consuming on Windows then it is on most Linux systems, it is recommended (at least for less experienced users) to just download the contained files for casiopeia within a compressed archive.
Afterwards, unpack the archive, and install casiopeia by running
python setup.py install
from the command line, within the unzipped folder.
Note
If this procedure is for some reason not applicable for you, you can consider adding the casiopeia directory to PYTHONPATH
instead, as described above for CasADi.
1.2.3.2. Upgrades¶
For upgrading casiopeia, you would again need to download a compressed archive.
Afterwards, you need to install the recent version by again running
python setup.py install
Warning
If you installed casiopeia by adding the directory to PYTHONPATH
, just place the newly obtained files in the previously defined path to upgrade to a new version of casiopeia. You do not not need to add the directory again to PYTHONPATH
then. Also, make sure not to add multiple versions of casiopeia to PYTHONPATH
, since this might lead to conflicts.
1.3. Recommendations¶
To speed up computations in casiopeia, it is recommended to install HSL for IPOPT. On how to install the solvers and for further information, see the page Obtaining HSL in the CasADi wiki.