Search Knowledge Base by Keyword

Python environment and dependencies

CLEOPE supports an extensive Python environment suited for EO data analysis purposes, shared among all registered users.

Installation

Pip is the package installer for Python.

Opening a new terminal, users can call

pip list

shell command to list all the installed packages and corresponding versions.

CLEOPE Python packages are installed to a system directory (i.e. /opt/tljh/user/lib/python3.7/site-packages) by default, which requires root access.
CLEOPE users have not admin rights, thus they cannot install packages visible to all users.

Opening a new terminal, users can run:

pip install –user <package_name>

or – specifying the version:

pip install –user <package_name>==<version>

The –user option makes pip install packages into users own home directory, which does not require any special privileges.

Please note that the pip channel requires that also all the needed dependencies are installed as well.

Once the installation is complete, additional packages are installed to users own home directory path, i.e. /home/jupyter-user/.local/lib/python3.7/site-packages.

Add modules to the local path

By default, Python looks for its modules and packages in its absolute PATH. Within a python script, users can add path(s) occasionally to the default path by adding the following lines in the head section of the python application or script:

import sys

sys.path.append(‘/home/jupyter-user/directory’)

For instance, for the modules folder in the example notebooks suite:

import os, sys

sys.path.append(os.path.join(os.path.expanduser(“~”),”CLEOPE/Trials/modules”))

In this way all the scripts contained in the modules folder are callable within the same Jupyter Notebook.