Install ESA SNAP ToolBox along with Current Updates and Snappy Python on UBUNTU 18.04 for Satellite Imagery Analysis

Install GDAL libraries which is the most important prerequisite for building ESA SNAP toolbox.

Kaustav Mukherjee
4 min readJan 17, 2022

sudo apt install — reinstall gdal-bin libgdal-dev python-gdal python3-gdal

For Installing Snap Toolbox for Ubuntu ,we need to go to the following link and :

Click the Ubutu Software link to download the Snap Toobox Installer for Ubuntu

Or

We can directly download in command line using

wget https://download.esa.int/step/snap/8.0/installers/esa-snap_sentinel_unix_8_0.sh

Give the permission to execute the installer:

sudo chmod 777 esa-snap_sentinel_unix_8_0.sh

Install the Software:

$ ./esa-snap_sentinel_unix_8_0.sh

Unpacking JRE …

Starting Installer …

This will install ESA SNAP on your computer.

OK [o, Enter], Cancel [c]

Click Next to continue, or Cancel to exit Setup.

Delete SNAP’s configuration data and user settings?

The installer detected SNAP user data directories from a previous

installation. These directories contain system file used by the application

and also stored graphs, RGB profiles or other auxiliary data. The data

stored in these directories might not be compatible with this new SNAP

version anymore.

Shall the installer try to remove these directories?

Yes, try deleting all SNAP user data [1], Delete only SNAP-internal configuration data (recommended). [2, Enter]

Select the folder where you would like ESA SNAP to be installed, then click

Next.

Where should ESA SNAP be installed?

[/home/system/snap]

Which components should be installed?

X: SNAP [*1]

2: Sentinel-1 Toolbox [*2]

3: Sentinel-2 Toolbox [*3]

4: Sentinel-3 Toolbox [*4]

5: Radarsat Toolbox [*5]

(To show the description of a component, please enter one of *1, *2, *3, *4, *5)

Please enter a comma-separated list of the selected values or [Enter] for the default selection:

[2,3,4,5]

Create symlinks?

Yes [y, Enter], No [n]

Select the folder where you would like ESA SNAP to create symlinks, then click Next.

[/usr/local/bin]

Which is your preferred Python version?

If you are a Python developer, you can use the SNAP Java API from Python or

you can even develop SNAP processor plugins using Python. Here you can

specify your preferred Python version by the given Python executable to be

used. Only Python versions 2.7, 3.3 and 3.4 are supported.

Configure SNAP for use with Python?

Yes [y], No [n, Enter]

You may type which python in a terminal window to find the path to your

preferred Python version.

After successful configuration you will find the SNAP Python module snappy

in the directory /home/system/.snap/snap-python. The Python interpreter and

the location of the snappy module can be changed any time using the

bin/snappy-conf tool.

Extracting files …

Setup has finished installing ESA SNAP on your computer.

Run SNAP Desktop?

Yes [y, Enter], No [n]

n

From the above console output it is evident that the Snap has been installed in the home folder which is /home/system:

/home/system/snap

Once the Snap Toolbox is installed build the Snap python module:

cd /home/system/snap

cd bin

./snappy-conf /usr/bin/python3.6

/home/system/snap/bin/../platform/lib/nbexec: WARNING: environment variable DISPLAY is not set

Configuring SNAP-Python interface…

Done. The SNAP-Python interface is located in ‘/home/system/.snap/snap-python/snappy’

When using SNAP from Python, either do: sys.path.append(‘/home/system/.snap/snap-python’)

or copy the ‘snappy’ module into your Python’s ‘site-packages’ directory.

[Note: /usr/bin/python3.6 is the python executable path.That means the snappy python package is get installed in the python environment of the executable /usr/bin/python3.6]

Update Snap Toolbox for the latest updates in order to have all the functionalities execute smoothly:

Go to home folder of SNAP located in the $HOME folder as metioned during SNAP installation.

cd /home/system/snap

cd bin

./snap — nogui — modules — update-all

This will apply all the modules and once the updates are done it will show messages as mentioned below:

Updates not found.

updates=0

***BUG!!!! Press CTL+C and end the process .This a bug that after updating the system hangs.

As a workaround for this BUG we can also follow the steps given in https://senbox.atlassian.net/wiki/spaces/SNAP/pages/30539785/Update+SNAP+from+the+command+line#UpdateSNAPfromthecommandline-Updatespecificmodules

snap --nosplash --nogui --modules --update-all 2>&1 | while read -r line; do

echo "$line"

[ "$line" = "updates=0" ] && sleep 2 && pkill -TERM -f "snap/jre/bin/java"

done

Test whether the Updates are applied properly:

./snap — nosplash — nogui — modules — list — refresh

./../platform/lib/nbexec: WARNING: environment variable DISPLAY is not set

Refreshing SNAP Supported Plugins

Refreshing SNAP Core

Refreshing SNAP Toolboxes

Code Name Version State

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

org.csa.rstb.rstb.op.polarimetric.tools 8.0.5 Enabled

org.esa.s2tbx.s2tbx.s2msi.reader 8.0.5 Enabled

org.esa.snap.snap.temporal.percentile 8.0.9 Enabled

org.netbeans.swing.plaf 1.41.1 Enabled

org.netbeans.modules.extexecution 1.48.1 Enabled

org.esa.snap.snap.unmix.ui 8.0.9 Enabled

org.netbeans.modules.options.api 1.45.1 Enabled

org.esa.snap.snap.pgx.reader 8.0.9 Enabled

org.esa.snap.snap.remote.products.repository 8.0.9 Enabled

org.openide.modules 7.48.1 Enabled

org.esa.s2tbx.s2tbx.forest.cover.change 8.0.5 Enabled

org.esa.snap.snap.smart.configurator.ui 8.0.9 Enabled

org.esa.s3tbx.s3tbx.landsat.reader 8.0.4 Enabled

org.esa.sen2coral.sen2coral.kit 1.0.0 Available

org.openide.util.lookup 8.33.1 Enabled

org.netbeans.modules.masterfs.nio2 1.15.1 Enabled

org.esa.s2tbx.s2tbx.alosAV2.reader 8.0.5 Enabled

Test Whether snappy python is working:

/usr/bin/python3.6

import sys
sys.path.append(‘/home/system/.snap/snap-python’)

from snappy import ProductIO

--

--

Kaustav Mukherjee

DISTRBUTED DEEP LEARNING ARCHITECT,DATA PHILOSOPHER,MACHINE LEARNING ON REAL-TIME STREAMS