Installing Caelus Python Library (CPL)¶
CPL is a python package for use with Caelus CML simulation suite. Therefore, it is assumed that users have a properly functioning CML installation on their system. In addition to Caelus CML and python, it also requires several scientific python libraries:
- NumPy – Arrays, linear algebra
- Pandas – Data Analysis library
- Matplotlib – Plotting package
The quickest way to install CPL is to use the official installer provided by Applied CCM. Once installed, please proceed to Check installation to learn how to use CPL.
For users wishing to install CPL from the git repository, this user guide recommends the use of Anaconda Python Distribution. This distribution provides a comprehensive set of python packages necessary to get up and running with CPL. An alternate approach using Python virtualenv is described at the end of this section, but will require some Python expertise on the part of the user.
The default installation instructions use Python v2.7. However, CPL is designed to work with both Python v2.7 and Python v3.x versions.
Installing CPL with Anaconda Python Distribution¶
Install Anaconda¶
- Download the Anaconda installer for your operating system.
- Execute the downloaded file and follow the installation instructions. It is recommended that you install the default packages.
- Update the anaconda environment according to installation instructions
Note
Make sure that you answer yes
when the installer asks to add the
installation location to your default PATH locations. Or else the following
commands will not work. It might be necessary to open a new shell for the
environment to be updated.
Install CPL¶
Obtain the CPL source from the public Git repository.
# Change to directory where you want to develop/store sources git clone https://bitbucket.org/appliedccm/CPL cd CPL
Create a custom conda environment
# Ensure working directory is CPL conda env create -f etc/caelus2.yml
Note
- Developers interested in developing CPL might want to install the
development environment available in
etc/caelus2-dev.yml
. This installs additional packages likesphinx
for document generation, andpytest
for running the test suite. - By default, the environment created is named
caelus2
when usingetc/caelus2.yml
andcaelus-dev
when usingetc/caelus2-dev.yml
. The user can change the name of the environment by using -n <env_name> option in the previous command. - Users wishing to use Python 3.x should replace
etc/caelus2.yml
withetc/caelus3.yml
. Bothcaelus2
andcaelus3
environment can be used side by side for testing and development.
- Developers interested in developing CPL might want to install the
development environment available in
Activate the custom environment and install CPL within this environment
source activate caelus2 pip install .
For editable development versions of CPL use
pip install -e .
instead.
After completing this steps, please proceed to Check installation to test that your installation is working properly.
Alternate Installation – Virtualenv¶
This method is suitable for users who prefer to use the existing python
installations in their system (e.g., from apt-get
for Linux systems). A
brief outline of the installation process is described here. Users are referred
to the following documentation for more assistance:
Prepare system for virtual environment¶
- Install necessary packages
# Install necessary packages pip install virtualenv virtualenvwrapperWindows users must use
virtualenvwrapper-win
instead of thevirtualenvwrapper
mentioned above. Alternately, you might want to install these packages viaapt-get
oryum
.
Update your ~/.bashrc or ~/.profile with the following lines:
export WORKON_HOME=~/ENVS/ source /usr/local/bin/virtualenvwrapper.sh
Adjust the location of
virtualenvwrapper.sh
file according to your system installation location.
Useful virtualenvwrapper commands¶
mkvirtualenv
- Create a new virtual environmentworkon
- Activate a previously created virtualenv, or switch between environments.deactivate
- Deactive the current virtual environmentrmvirtualenv
- Delete an existing virtual environmentlsvirtualenv
- List existing virtual environments
Install CPL¶
Obtain the CPL source from the public Git repository.
# Change to directory where you want to develop/store sources git clone https://bitbucket.org/appliedccm/CPL cd CPL
Create a virtual environment with all dependencies for CPL
# Create a caelus Python 2.7 environment mkvirtualenv -a $(pwd) -r requirements.txt caelus2
Activate virtual environment and install CPL into it
# Ensure that we are in the right environment workon caelus2 pip install . # Install CPL within this environment
Note
- Use
--system-site-packages
with themkvirtualenv
command to reuse python modules installed in the system (e.g., viaapt-get
) instead of reinstalling packages locally within the environment. - Use
mkvirtualenv --python=PYTHON_EXE
to customize the python interpreter used by the virutal environment instead of the default python found in your path.
Check installation¶
After installing CPL, please open a command line terminal and execute
caelus -h to check if the installation process was completed
succesfully. Note that users who didn’t use the installer provided by Applied
CCM might need to activate their environment before the caelus
command is
available on their path. If everything was installed and configured
successfully, users should see a detailed help message summarizing the usage of
caelus. At this stage, you can either learn about building
documentation and executing unit tests (provided with CPL) in the next sections
or skip to Configuring Caelus Python Library to learn how to configure and use CPL.
Building documentation¶
A local version of this documentation can be built using sphinx. See Install CPL for more details on installing the developer environment and sources.
# Change working directory to CPL
cd docs/
# Build HTML documentation
make html
# View in browser
open build/html/index.html
# Build PDF documentation
make latexpdf
open build/latex/CPL.pdf