Installing OpenDrift
Alternative 1: Using Mambaforge (or Miniforge) and Git (recommended)
Install miniforge
Clone OpenDrift:
$ git clone https://github.com/OpenDrift/opendrift.git
$ cd opendrift/
Create environment with the required dependencies and install OpenDrift
$ mamba env create -f environment.yml
$ conda activate opendrift
$ pip install --no-deps -e .
This installs the OpenDrift package as an editable package. You can therefore directly make changes to the repository or fetch the newest changes with git pull
. You do not need to add OpenDrift to PYTHONPATH as long as you have the opendrift
environment activated.
Occasionally, new dependencies will be added to environment.yml. Then the local conda environment can be updated with:
$ mamba env update -f environment.yml
Alternative 2: Using Mambaforge (or Miniforge)
Install miniforge
Set up a Python 3 environment for opendrift and install opendrift
$ mamba create -n opendrift python=3 opendrift
$ conda activate opendrift
Modify install to use Git version
If you later want to edit the OpenDrift source code, or be able to update from repository with git pull, the following two steps are necessary. This yields the same as Alternative 1.
Clone OpenDrift:
$ git clone https://github.com/OpenDrift/opendrift.git
$ cd opendrift/
Remove original package:
$ mamba remove --force opendrift
Install as editable:
$ pip install --no-deps -e .
Building and using the Docker image
It is also possible to run OpenDrift in a docker container. You can either use the pre-built images (each release or latest master):
$ docker run -it --rm opendrift/opendrift:latest
or if you want to re-build the image using your local version of opendrift, check out opendrift and make your changes, then:
$ git clone https://github.com/OpenDrift/opendrift.git
$ cd opendrift/
re-build the image:
$ docker build -t opendrift .
and run it:
$ docker run -it --rm opendrift