Python#

Usage#

SEPAL instances run on focal ubuntu machines and thus provide a fully functional Pyhton 3.8 environment. This environment is accecible though Jupyter Notebook, JupyterLab or the terminal:

Description#

The SEPAL python environment is not empty and embed numerous librairies. They are listed here:

# version 2022-09-04
########  geospatial data analysis  ########
scikit-image
scipy
shapely
shapely-geojson
tqdm
xarray-leaflet
GDAL==$GDAL_VERSION
bqplot
numpy==$NUMPY_VERSION
geopandas
matplotlib
pandas
dask[complete]
planet
tensorflow-probability
geeadd

########  Google Earthengine  ########
oauth2client
google-api-python-client==1.12.8
git+https://github.com/openforis/earthengine-api.git@v0.1.319#egg=earthengine-api&subdirectory=python
oeel

########  BFAST dependencies ########
wget
Sphinx==2.2.0
sphinx-bootstrap-theme==0.7.1
numpydoc
git+https://github.com/12rambau/bfast.git

########  sepal modules  ########
geemap
Unidecode
pyperclip
python-dateutil
pytesmo
Wand
PyPDF2 # more recent version are avaiable (PyPDF4)
rasterio
openpyxl
pre-commit

########  web api  ########
falcon
gunicorn
pyCrypto
awscli

########  other deps  ########
requests
llvmlite
coverage

########  OSK requirements  ########
descartes
fiona
godale
psycopg2-binary
imageio
rtree
retrying
Cython
pyproj==2.6.1 # Require proj update before 3.0.0 can be installed

########  Early Warning System for Canopy Disturbances in Ecuador (SATA)  ########
nose
nosexcover
pylint
click
dateutils
boto3

Run pip freeze | grep <name of your lib> to check if it’s already installed.

Customization#

The SEPAL environment can be customized to user needs using any third-party librairies and pip. By default installation will be run in --user mode and won’t affect other SEPAL users.

Note

If you face compatibility issues when customizing your SEPAL environment, please let us know in the Github issue tracker.

Virtual environment#

Warning

SEPAL does not support conda environments, if you need to install compiled librairies, please the SEPAL team via the Github issue tracker.

SEPAL supports python venv creation. in this section we’ll explain how you can create a venv and link it to Jupyter so you can run your processes on the associated kernel.

By design Jupyter is runnnig on the Python Kernel described in the previous section. you can also use the kernel associated to our applications (they start with venv). If your work rely on very specific version numbers it might be good to run everything on a dedicated environment.

If not existing, create a directory to host your virtual environments. From the root directory run:

mkdir venv

in this folder create a virtual environment:

cd venv
python3 -m venv <venv_name>

Now create a Jupyter Kernel linked to this venv:

./<venv_name>/python3 -m ipykernel install --user --name <venv_name> --display-name <a name to display>

Now this venv will be available as a kernel inside your Jupyter workspace. This kernel will be automatically removed if you destroy the venv directory.

If you want to install libs inside this venv you need first to activate it:

./<venv_name>/bin/activate