Installing SNAP and Snappy inside virtual environment?

I have a headless setup with Linux. I used the following configuration file

# Installation configuration file for ESA SNAP 13.0.0
deleteAllSnapEngineDir$Boolean=false
deleteOnlySnapDesktopDir$Boolean=true
executeLauncherWithPythonAction$Boolean=false
#forcePython$Boolean=false
#pythonExecutable=...
sys.adminRights$Boolean=true
sys.component.RSTB$Boolean=true
sys.component.S1TBX$Boolean=false
sys.component.S2TBX$Boolean=true
sys.component.S3TBX$Boolean=false
sys.component.SNAP$Boolean=true
sys.installationDir=/storage/shared/gis/snap/
sys.languageId=en
sys.programGroupDisabled$Boolean=false
#sys.symlinkDir=/storage/shared/gis/

in order to install SNAP

esa-snap_sentinel_linux-13.0.0.sh -q -varfile snap_varfile

I chose not to install Python since I found out that it can be done post-installation via the command line tool version of SNAP and I want to use everything inside a virtual environment.

After several hours of trying I found out that snappy-conf, which is indirectly invoked when running

snap --nogui --nosplash --snappy <python-interpreter-executable> <python-site-packages-or-wherever-esa_snappy-is-installed>

relies on a configuration file snappy.properties, which is put inside

~/.snap/snap-python/snappy.properties 

regardless of where SNAP is installed. I discovered this the hard way since I was doing

snappy-conf env/bin/python3.10 env/lib/python3.10/site-packages/

inside my project folder, where I have set up my virtual environment. I was getting the infamous Python configuration error so I started pocking around just to find out that the command above produced a snappy.properties file with the following content

#Created by eu.esa.snap.snappy.PyBridge
#Thu Feb 12 15:23:10 CET 2026
snap.pythonExecutable=env/bin/python3.10
snap.pythonModuleDir=env/lib/python3.10/site-packages

indicating that the configuration script for Snappy does not resolve the absolute path (easily accomplished with pathlib for example). After putting the full path there I was able to configure Snappy for my virtual environment.

That said, this indicates a bigger problem, namely that the installation of SNAP is not self-contained (even though it comes with its own JRE and so on). If I am to use it inside a container, it will not be a problem. However, in a setup where one may have multiple environments (same Python version) for different projects all relying on the same SNAP installation this cannot work.

If someone has an info on how to install SNAP in a more encapsulated way (e.g. using Mamba/Anaconda), it will be greatly appreciated.

Last but not least, the documentation on the headless installation is lacking at best. The varfile file I found on GitHub by randomly checking forum threads and tutorials.

Hello alat,

sorry to hear you have issues with your headless setup. You might be right that there is some lack of documentation. We’ll check and see what we can improve.

Regarding the call of snappy-conf: yes, the full path to the Python executable is expected to specify the ‘right’ Python (as you say, you might have several Python envs installed). Thus, the listing of your generated snappy.properties looks reasonable. Sorry if this is not stated clearly enough in the instructions. - And yes, if you want to switch between different Python envs for different projects, you have to re-run snappy-conf accordingly.Indeed, you cannot use ‘several Pythons at the same time’ with SNAP (if this is what you are complaining about).

Cheers,
Olaf

You might be right that there is some lack of documentation. We’ll check and see what we can improve

Update: Regarding the headless installation, there is appropriate documentation available here. I fixed a few links in the text which were outdated.

Moreover, the navigation starting from the documentation entry page has been slightly improved to better point the SNAP users to the User Guide and its sub-pages.