Installation

CRATE is a simple Python package (cratepy) available from the Python Package Index (PyPI). This means that running CRATE requires solely a Python 3 installation and a few well-known Python packages used for scientific computing and data science.

Note

Whether you are using Linux, MacOS or Windows, Python can be easily installed by following the Python Getting Started official webpage. Many other resources are available to help you install and setup Python (e.g., Real Python).


Installation from Python Package Index

The standard way of installing CRATE is through pip, a package manager that installs Python packages from PyPI. After installing pip, a package can be installed as described here and here.

CRATE can be simply installed by running the following pip installation command:

pip install -U cratepy

By following this installation option, you will get CRATE most recent available version on PyPI, i.e., the latest distribution version of CRATE’s main source code uploaded to PyPI. Note that, besides installing CRATE, pip also installs all the required Python package dependencies automatically.


Installation from source

To install CRATE from the associated GitHub repository, follow the steps below:

  • Clone CRATE GitHub repository into a local directory (check git documentation for details) by running the following command:

    git clone git@github.com:bessagroup/CRATE.git
    
  • In the cloned repository root directory, install CRATE by running the following pip installation command (check pip regular installation from local project for details):

    pip install .
    

Note

From a development point of view, it may be of interest to install CRATE in “editable” mode by adding the -e option to the pip installation command as pip install -e . (check here for details).

By following this installation option, you will get the complete CRATE project content besides the source code, namely the documentation source and a directory with fully documented benchmarks (see Benchmarks).


Using CRATE without installation

It is also possible to use CRATE without an actual installation, provided you clone CRATE GitHub repository into a local directory by running the following command:

git clone git@github.com:bessagroup/CRATE.git

In this case, make sure that all the required Python package dependencies (listed in requirements.txt) are installed. This can be done manually or automatically by running the following pip installation command:

pip install -r requirements.txt

To successfully import CRATE in your Python project, CRATE’s source code directory must be then explicitly added to sys.path as follows:

import sys
# Add project directory to sys.path
root_dir = "/path/to/project/CRATE/src"   # Replace by CRATE's source code path!
if root_dir not in sys.path:
    sys.path.insert(0, root_dir)

import cratepy