Snappy installation on MacOS Catalina

I am trying to set up snappy (SNAP v7) to work on my Mac with Catalina OS (10.15).
Upon installation of SNAP I specified the python version to use, but it does not work.
I have followed the list of steps: installed jpy, JDK, Maven, created the wheels, and copied them over to the site-packages snappy folder of my conda environment.

I have gotten to the stage of running the .snappy-conf command:
sudo ./snappy-conf /opt/anaconda3/envs/pysar/bin/python /opt/anaconda3/envs/pysar/lib/python3.7/site-packages

Output:
Configuring SNAP-Python interface…

java.io.IOException: Python configuration failed.

Command [/opt/anaconda3/envs/pysar/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --jvm_max_mem 11G --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64]
failed with return code 97.

Please check the log file ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/snappyutil.log’.
at org.esa.snap.python.PyBridge.configureJpy(PyBridge.java:232)
at org.esa.snap.python.PyBridge.installPythonModule(PyBridge.java:149)
at org.esa.snap.rcp.cli.SnapArgsProcessor.processPython(SnapArgsProcessor.java:103)
at org.esa.snap.rcp.cli.SnapArgsProcessor.process(SnapArgsProcessor.java:49)
at org.netbeans.modules.sendopts.DefaultProcessor.process(DefaultProcessor.java:202)
at org.netbeans.spi.sendopts.Option$1.process(Option.java:387)
at org.netbeans.api.sendopts.CommandLine.process(CommandLine.java:317)
at org.netbeans.modules.sendopts.HandlerImpl.execute(HandlerImpl.java:62)
at org.netbeans.modules.sendopts.Handler.cli(Handler.java:69)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.core.startup.CLICoreBridge.cli(CLICoreBridge.java:82)
at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
at org.netbeans.CLIHandler$1.exec(CLIHandler.java:268)
at org.netbeans.CLIHandler.finishInitialization(CLIHandler.java:447)
at org.netbeans.MainImpl.finishInitialization(MainImpl.java:256)
at org.netbeans.Main.finishInitialization(Main.java:92)
at org.netbeans.core.startup.Main.start(Main.java:316)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
at java.lang.Thread.run(Thread.java:748)

Python configuration error: Python configuration failed.

Command [/opt/anaconda3/envs/pysar/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --jvm_max_mem 11G --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64]
failed with return code 97.

The snappyutil.log gives the following:
INFO: Installing from Java module ‘/Applications/snap/snap/modules/org-esa-snap-snap-python.jar’
INFO: Installing jpy…
INFO: Unzipping ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/jpy-0.10.0.dev1-cp37-cp37m-macosx_10_9_x86_64.whl’
INFO: Configuring jpy…
INFO: jpy Python API configuration written to ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/jpyconfig.py’
INFO: jpy Java API configuration written to ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/jpyconfig.properties’
INFO: Configuring snappy…
INFO: snappy configuration written to ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/snappy.ini’
INFO: Importing snappy for final test…

I saw that the Java location is wrong in the snappyutil.py script, so I reran it manually:

sudo /opt/anaconda3/envs/pysar/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --jvm_max_mem 11G --java_home /Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home --req_arch x86_64

This returns the following:
jpyutil - INFO: jpy Python API configuration written to ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/jpyconfig.py’
jpyutil - INFO: jpy Java API configuration written to ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/jpyconfig.properties’

No Java runtime present, requesting install.

But I DO HAVE Java JDK installed, and I have set the environment variables, like so:
export JDK_HOME=$(/usr/libexec/java_home)
export JAVA_HOME=$JDK_HOME
#Apache Maven link to PATH:
export PATH=/opt/apache-maven-3.6.3/bin:$PATH

Any suggestions?

1 Like

Hi, since my upgrade to Catalina I am getting the same issue. Furthermore, when I run snappy-conf the following window pops up.

Screenshot 2020-03-31 at 13.18.08

However, I can’t install this version of Java because the OS says that there is a newer version. I am really hoping there is an alternative to the solution here: https://www.harrisgeospatial.com/Support/Self-Help-Tools/Help-Articles/Help-Articles-Detail/ArtMID/10220/ArticleID/23780/Mac-OS-Catalina-1015-ENVIIDL-and-Legacy-Java-6-Dependencies

Hi Maxim,

that’s strange. Actually, SNAP/snappy brings it’s own JRE. So there should be no need for an external JRE. Version 6 of Java we do not use since quite some time.
You have SNAP 7 installed, right?
Maybe some remainings of an old installation somewhere?

Hi Marco,

Yes I’m running SNAP 7.0, that I have just installed. Before that I had SNAP 7 beta running.
Indeed, the “snappy-conf” command yields:

/Users/maxim/opt/anaconda3/envs/snappy_env/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --jvm_max_mem 2G --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64

The log has no relevant information. Could it come from the jpy build (there are a number of warnings during the build)?

No idea at the moment. Haven’t touched this area for a while.

1 Like

Just to add to the discussion - I made a fresh installation, my computer recently got a hard drive clean sweep and the Catalina upgrade. So this problem is not from an old installation.

I understand now that the snappy_conf command points to the JRE packaged with SNAP, but for some reason this does not work - hence that return code 97.

I reran snappyutil.py with the following arguments:
sudo /opt/anaconda3/envs/pysar/bin/python ./snappyutil.py --snap_home /Applications/snap --java_module /Applications/snap/snap/modules/org-esa-snap-snap-python.jar --force --log_file ./snappyutil.log --jvm_max_mem 11G --java_home /Applications/snap/.install4j/jre.bundle/Contents/Home/jre --req_arch x86_64

The output is the following:
jpyutil - INFO: jpy Python API configuration written to ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/jpyconfig.py’
jpyutil - INFO: jpy Java API configuration written to ‘/opt/anaconda3/envs/pysar/lib/python3.7/site-packages/snappy/jpyconfig.properties’
No Java runtime present, requesting install.

I repeated the call with a slightly different java location:
–java_home /Applications/snap/.install4j/jre.bundle/Contents/Home
but no luck there either…

I tried with Snap version 6 to see, as it was working last year on my Mac, but ran into the same issues.
I also tried with JDK 8 and JDK 11: same problem!

I changed the Info.plist file as in this answer, then was able to successfully configure snappy.

2 Likes

Thank you, I followed this advice and the installation/configuration worked for me as well.

1 Like

Hello, I have tried the above and I cannot get this to work on Catalina.

My snappyutil.log file says:

INFO: Installing from Java module '/Applications/snap/snap/modules/org-esa-snap-snap-python.jar'
INFO: Installing jpy...
ERROR: Traceback (most recent call last):
  File "./snappyutil.py", line 273, in _main
    ret_code = _configure_snappy(snap_home=args.snap_home,
  File "./snappyutil.py", line 144, in _configure_snappy
    logging.error(["The module 'jpy' is required to run snappy, but no binary 'jpy' wheel matching the pattern",
AttributeError: 'list' object has no attribute 'join'

ERROR: Configuration failed with exit code 40

So when I try to get jpy installed I have issues; I posted on their github issues page:

203 warnings and 1 error generated.
      error: command 'gcc' failed with exit status 1

Anyone run into this issue?

The “‘list’ object has no attribute ‘join’” problem should be fixed in SNAP8. Are you still using SNAP 7?