> For the complete documentation index, see [llms.txt](https://the-academic-observatory.gitbook.io/bas/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://the-academic-observatory.gitbook.io/bas/installing-bad-workflows.md).

# Installing BAD Workflows

Dependencies:

* Python 3.10
* pip
* [Python virtualenv](https://docs.python.org/3/library/venv.html) (recommended)
* [Docker Engine](https://docs.docker.com/engine/) or [Docker Desktop](https://docs.docker.com/desktop/)
* [The Observatory Platform](https://github.com/The-Academic-Observatory/observatory-platform)

See below for more a detailed walk-through of the installation process.

## Installing System Dependencies

{% tabs %}
{% tab title="Ubuntu 20.04+" %}

Update packages list and install software-properties-common:

```bash
sudo apt update
sudo apt install software-properties-common
```

Add deadsnakes PPA which contains Python 3.10 for Ubuntu 20.04; press `Enter` when prompted:

```bash
sudo add-apt-repository ppa:deadsnakes/ppa
```

Install Python 3.10:

```bash
sudo apt install python3.10 python3.10-dev
```

Install pip:

```bash
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.10 get-pip.py
```

Install virtualenv:

```
pip install --upgrade virtualenv
```

Install Docker Engine:

* Following the [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/) tutorial.
* Make sure that Docker can be run without sudo, e.g. `sudo usermod -aG docker your-username`
  {% endtab %}

{% tab title="MacOS" %}

Install [Homebrew](https://brew.sh/) with the following command:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```

Install Python 3.10 with brew:

```bash
brew install python@3.10
```

Add Python 3.10 to path:

```bash
echo 'export PATH="/usr/local/opt/python@3.8/bin:$PATH"' >> ~/.bash_profile
```

Install virtualenv 20 or greater:

```
pip3.10 install --upgrade virtualenv
```

Install Docker Desktop:

* Follow the [Install Docker Desktop on Mac](https://docs.docker.com/docker-for-mac/install/) tutorial.
  {% endtab %}
  {% endtabs %}

## Creating a Python Virtual Environment

It is highly recommended to create a [Python virtual environment](https://docs.python.org/3/library/venv.html) before installing the Observatory Platform and BAD workflows. To create a new virtual environment, execute the following command:

```bash
python3.10 -m venv MY_VENV_NAME # Change MY_VENV_NAME to whatever you please
```

To activate/deactivate the environment:

```bash
source MY_VENV_NAME/bin/activate # Activate
deactivate # Deactivate
```

While active, all changes to Python packages will be contained to the environment. Similarly, any Python run commands will be done in the context of the active environment. **It is recommended that the following packages are installed to an active virtual environment**, although there is no reason that the BAD Workflows could not be run without one.

## The Observatory Platform

Make sure that you have followed the above instructions before installing the observatory-platform.

Clone the [Observatory Platform repository](https://github.com/The-Academic-Observatory/observatory-platform):

```bash
git clone https://github.com/The-Academic-Observatory/observatory-platform
```

Install the `observatory-platform` package:

```bash
pip install observatory-platform --constraint https://raw.githubusercontent.com/apache/airflow/constraints-2.7.3/constraints-no-providers-3.10.txt
```

## BAD Workflows

Clone the [BAD workflows repository](https://github.com/The-Academic-Observatory/oaebu-workflows) (oaebu-workflows)

```bash
git clone https://github.com/The-Academic-Observatory/oaebu-workflows.git
```

Install the workflows to the active python environment&#x20;

```
pip install oaebu-workflows
```
