Skip to content

Setting up a local Python environment

Frederik Kratzert edited this page May 17, 2022 · 1 revision

When extending Caravan to new basins, you will need to process the output of Google Earth Engine locally and merge it with streamflow data. This is done in Caravan_part2_local_postprocessing.ipynb. To be able to run this notebook locally, you need a Python environment with the following specification:

  • Python >= 3.7
  • jupyter
  • netcdf4
  • numba
  • pandas
  • tqdm
  • xarray
  • timezonefinder[numba]

To help you get started, we provided two different ways how to prepare your Python environment locally.

Using Anaconda/Miniconda

Our recommended way is to use Anaconda or Miniconda for managing different Python environments locally. If you have either of those installed locally, you can create a Python environment from the Terminal/Bash by the following command (assuming you are within the Caravan root directory):

conda env create -f environments/environment.yml

Afterwards you can activate the environment by:

conda activate caravan

Using default Python or Venv

From within your virtual environment or default Python environment, you can install the required libraries by executing

pip install -r environments/requirements.txt

Starting JuPyter

Assuming that everything above was done correctly, you can start your local JuPyter server by running

jupyter notebook

This will open a tab in your browser from which you open the Caravan_part2_local_postprocessing.ipynb notebook and start working.