Dockerising SNAP + Snappy (Python 3.6)

Hi folks,

I’ve done a bit of searching and couldn’t find anything that looked like someone had got SNAP + Snappy setup with Python 3.6.

I’m working on a project where I’m hoping to dockerise snappy in particular for cloud-based processing.

Currently my Dockerfile looks like so:

FROM ubuntu:bionic-20200311

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -y build-essential curl gcc git libbz2-dev libffi-dev liblzma-dev \
    libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev llvm make \
    openjdk-8-jdk python3.6 python-openssl python3-distutils tk-dev wget xz-utils zlib1g-dev

ENV JDK_HOME /usr/lib/jvm/java-8-openjdk-amd64/

RUN wget
RUN chmod +x
RUN ./ -q

RUN /usr/local/snap/bin/snappy-conf $(which python)

When the last line runs, I get the following:

/usr/local/snap/bin/../platform/lib/nbexec: WARNING: environment variable DISPLAY is not set
Configuring SNAP-Python interface... Python configuration failed.
Command [/usr/bin/python ./ --snap_home /usr/local/snap --java_module /usr/local/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --jvm_max_mem 8G --java_home /usr/local/snap/jre --req_arch amd64]
failed with return code 30.
Please check the log file '/root/.snap/snap-python/snappy/snappyutil.log'.
        at org.esa.snap.python.PyBridge.configureJpy(
        at org.esa.snap.python.PyBridge.installPythonModule(
        at org.esa.snap.rcp.cli.SnapArgsProcessor.processPython(
        at org.esa.snap.rcp.cli.SnapArgsProcessor.process(
        at org.netbeans.modules.sendopts.DefaultProcessor.process(
        at org.netbeans.spi.sendopts.Option$1.process(
        at org.netbeans.api.sendopts.CommandLine.process(
        at org.netbeans.modules.sendopts.HandlerImpl.execute(
        at org.netbeans.modules.sendopts.Handler.cli(
        at org.netbeans.CLIHandler.notifyHandlers(
        at org.netbeans.core.startup.CLICoreBridge.cli(
        at org.netbeans.CLIHandler.notifyHandlers(
        at org.netbeans.CLIHandler$1.exec(
        at org.netbeans.CLIHandler.finishInitialization(
        at org.netbeans.MainImpl.finishInitialization(
        at org.netbeans.Main.finishInitialization(
        at org.netbeans.core.startup.Main.start(
Python configuration error: Python configuration failed.
Command [/usr/bin/python ./ --snap_home /usr/local/snap --java_module /usr/local/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --jvm_max_mem 8G --java_home /usr/local/snap/jre --req_arch amd64]
failed with return code 30.
Please check the log file '/root/.snap/snap-python/snappy/snappyutil.log'.

If I cat the log file:

INFO: Installing from Java module '/usr/local/snap/snap/modules/org-esa-snap-snap-python.jar'
WARNING: Architecture requirement possibly not met: Python is x86_64 but JVM requires amd64
INFO: Installing jpy...
INFO: Extracting 'lib/jpy-0.9.0-cp27-cp27mu-linux_x86_64.whl' from '/usr/local/snap/snap/modules/org-esa-snap-snap-python.jar'
INFO: Unzipping '/root/.snap/snap-python/snappy/lib/jpy-0.9.0-cp27-cp27mu-linux_x86_64.whl'
INFO: Configuring jpy...
INFO: jpy Python API configuration written to '/root/.snap/snap-python/snappy/'
INFO: jpy Java API configuration written to '/root/.snap/snap-python/snappy/'
INFO: Configuring snappy...
INFO: snappy configuration written to '/root/.snap/snap-python/snappy/snappy.ini'
INFO: Importing snappy for final test...
ERROR: Configuration failed with exit code 30

Not too sure where to go from here in trying to get this working. I have found which looked promising, but this is still Python 2, the PR for Python 3 seems dormant.

If anyone has any pointers, or has been trying the same thing, any input is appreciated!



Did you find any solution to this? I am using python 2.7 and got the same error message in log.

I haven’t no, was hoping something would pop up here!

OK. Thanks.

On Ubuntu bionic or Mint 19, SNAP + Snappy setup with Python 3.6 just works, so there isn’t much need to post on the internet.

I have snappy working in a Linux Mint 19 (based on bionic) VM, using the SNAP jre and Python 3.6, but it isn’t headless. Try replacing openjdk-8-jdk with openjdk-8-jre-headless and running with options to force your choice of JRE.

It looks like snappy-conf ignored your settings chose SNAP 's JRE (e.g.,snap_home/jre):

/usr/bin/python ./ --snap_home /usr/local/snap 
--java_module /usr/local/snap/snap/modules/org-esa-snap-snap-python.jar 
--force --log_file ./snappyutil.log --jvm_max_mem 8G 
--java_home /usr/local/snap/jre --req_arch amd64

You could play around with this command in the .snap/snap-python/snappy directory.

Awesome, thanks for the suggestion! I will give it a go and put an update here.

Appreciate it!

I had the same issue a few days ago. You can check my solution on Docker Hub:

Python 3.6.10:

Jupyter Lab

I hope that helps.