Problem installing snappy on mac m1

Hi,

Thank you for reading this and appreciate all of your help.
I have a problem installing snappy on my mac m1 for a long time. I read every single comments and posts here relating installing snappy on mac or window or linux but until now no progressing.

So my setup is:
MacBook Pro (14-inch, 2021)
Apple M1 Pro Chip
Mac OS Monterey

on terminal java -version:
java version “18.0.2” 2022-07-19
Java™ SE Runtime Environment (build 18.0.2+9-61)
Java HotSpot™ 64-Bit Server VM (build 18.0.2+9-61, mixed mode, sharing)

mvn -v :
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/apache-maven-3.8.6
Java version: 18.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-18.0.2.jdk/Contents/Home
Default locale: en_DE, platform encoding: UTF-8
OS name: “mac os x”, version: “12.5”, arch: “aarch64”, family: “mac”

nano .zshrc
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-18.0.2.jdk/Contents/Hom$
export PATH="$JAVA_HOME/bin:$PATH"
export JDK_HOME=$JAVA_HOME
export PATH="/opt/apache-maven-3.8.6/bin:$PATH"

I installed SNAP 9.0 and created a conda virtual environment called “py36” with Python version 3.6.

I did following steps

  1. git clone GitHub - jpy-consortium/jpy
  2. python3 setup.py bdist_wheel
  3. cd dist
  4. cp *.whl “/Users/hm/.snap/snap-python/snappy”
  5. cd /Applications/snap/bin
  6. ./snappy-conf /Users/hm/opt/miniconda3/envs/py36/bin/python3.6 /Users/hm/opt/miniconda3/envs/py36/lib/python3.6/site-packages

and i got this error

**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 [/Users/hm/opt/miniconda3/envs/py36/bin/python3.6 ./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 --req_arch x86_64]**

**failed with return code 30.**

**Please check the log file '/Users/hm/opt/miniconda3/envs/py36/lib/python3.6/site-packages/snappy/snappyutil.log'.**

the snappyutil.log:

**INFO: Installing from Java module '/Applications/snap/snap/modules/org-esa-snap-snap-python.jar'**
**INFO: Installing jpy...**
**INFO: Unzipping '/Users/hm/.snap/snap-python/snappy/jpy-0.12.0.dev0-cp36-cp36m-macosx_10_9_x86_64.whl'**
**INFO: Configuring jpy...**
**INFO: jpy Python API configuration written to '/Users/hm/.snap/snap-python/snappy/jpyconfig.py'**
**INFO: jpy Java API configuration written to '/Users/hm/.snap/snap-python/snappy/jpyconfig.properties'**
**INFO: Configuring snappy...**
**INFO: snappy configuration written to '/Users/hm/.snap/snap-python/snappy/snappy.ini'**
**INFO: Importing snappy for final test...**
**ERROR: Configuration failed with exit code 30**

in python3:

>>> import snappy
RuntimeError: jpy: internal error: static method not found: unwrapProxy(Ljava/lang/Object;)Lorg/jpy/PyObject;

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/hm/opt/miniconda3/envs/py36/lib/python3.6/site-packages/snappy/__init__.py", line 236, in <module>
    jpy.create_jvm(options=_get_snap_jvm_options())
SystemError: <built-in function create_jvm> returned a result with an error set

I would appreciate any comment and help. Thanks.

Hyeonmin

There are a few things to note.

2 Likes

Thank you so much for the reply.

(I use rosetta terminal)
I installed Java JDK v8 newly. I reinstalled maven too.
I installed 0.9.0 of jpy from your github link and then I could see finally “snappy install finished”

but then I faced a different error.

>>> import snappy

INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters

INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Incompatible GDAL 3.5.1 found on system. Internal GDAL 3.2.1 from distribution will be used.

INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.2.1 set to be used by SNAP.

Native library load failed.

java.lang.UnsatisfiedLinkError: /Users/hm/.snap/auxdata/gdal/gdal-3-2-1/lib/jni/libgdalalljni.dylib: dlopen(/Users/hm/.snap/auxdata/gdal/gdal-3-2-1/lib/jni/libgdalalljni.dylib, 0x0001): Library not loaded: '/usr/local/opt/jpeg/lib/libjpeg.8.dylib'

Referenced from: '/Users/hm/.snap/auxdata/gdal/gdal-3-2-1/lib/libtiff.5.dylib'

Reason: tried: '/usr/local/opt/jpeg/lib/libjpeg.8.dylib' (no such file), '/usr/local/lib/libjpeg.8.dylib' (no such file), '/usr/lib/libjpeg.8.dylib' (no such file), '/usr/local/Cellar/jpeg/9e/lib/libjpeg.8.dylib' (no such file), '/usr/local/lib/libjpeg.8.dylib' (no such file), '/usr/lib/libjpeg.8.dylib' (no such file)

SEVERE: org.esa.s2tbx.dataio.gdal.GDALLoader: Failed to initialize GDAL native drivers. GDAL readers and writers were disabled.java.lang.reflect.InvocationTargetException

INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.

And then I installed jpeg package by brew.

I renamed the file /usr/local/Cellar/jpeg/9e/lib/libjpeg.9.dylib to /usr/local/Cellar/jpeg/9e/lib/libjpeg.8.dylib

Now i can use snappy. It works without problem. Thank you so much!!!
I struggled for so long time and finally it works like a charm. Thank you thank you!

2 Likes

Greetings everyone!

I am also using the same Mac OS (Mac OS Monterey) and M1 Pro Chip. I have tried to install JDKv8 and maven using the rosetta terminal.

(I have tried both JDKv8 - zulu-8.jdk and adoptopenjdk-8.jdk)
(Apache Maven 3.8.6 84538c9988a25aec085021c365c560670ad80f63
Maven home: /opt/apache-maven-3.8.6
Java version: 1.8.0_292, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre
Default locale: en_DE, platform encoding: UTF-8
OS name: “mac os x”, version: “10.16”, arch: “x86_64”, family: “mac”)
python 3.7

Using 0.9.0 of jpy, i have built the .whl and followed these steps:

  1. git clone GitHub - jpy-consortium/jpy
  2. python3 setup.py bdist_wheel
  3. cd dist
  4. cp *.whl “/Users/hm/.snap/snap-python/snappy”
  5. cd /Applications/snap/bin
  6. ./snappy-conf /Users/hm/opt/miniconda3/envs/py36/bin/python3.6 /Users/hm/opt/miniconda3/envs/py36/lib/python3.6/site-packages

There are no errors while building the jpy wheel but however, i have this error after executing step6

INFO: Installing from Java module ‘/Applications/snap/snap/modules/org-esa-snap-snap-python.jar’
INFO: Installing jpy…
ERROR: The module ‘jpy’ is required to run snappy, but no binary ‘jpy’ wheel matching the pattern
‘jpy-{version}-cp36-{abi_tag}-macosx_10_9_x86_64.whl’ could be found.
You can try to build a ‘jpy’ wheel yourself, then copy it into
“/Users/pavanmugudasanjeevamurthy/.snap/snap-python/snappy”, and then run the configuration again.
Unzip the jpy sources in /Users/pavanmugudasanjeevamurthy/.snap/snap-python/snappy/jpy-.zip, then
cd jpy-<version> python setup.py bdist_wheel
cp dist/*.whl "/Users/pavanmugudasanjeevamurthy/.snap/snap-python/snappy" Or get the source code from https://github.com/bcdev/jpy and follow the build instructions: git clone GitHub - bcdev/jpy: A bi-directional Python-Java bridge used to embed Java in CPython or the other way round.
$ cd jpy
ERROR: Configuration failed with exit code 10

and when importing snappy ModuleNotFoundError

Can anybody please help me, @YumYumYumi you have succeeded in installing the snappy (on M1) can you please help me out with where I am going wrong?

Thanks in advance

Hi, I am running into the same issues on Alpine Linux 3.18 with Python 3.11.

After some research, my understandng of the current situation is, that snappy does not support jpy > 0.9.0, while jpy <= 0.9.0 does not work with Python > 3.9.

The jpy wheel builds fine, but configuring snappy fails. So my question is, are there any updates on the issue and what are the plans regarding newer Python versions?

Any help is very much appreciated…

With the next release (scheduled for end of June) there will be a revised version compatible with newer Python version (at least 3.10).

Thanks @marpet for the swift reply. Looking forward to June then!

Hi again, hope you all had a nice summer!
Just want to kindly ask if there are any updates on this issue? And can you already envision if Python 3.11 will be supported as well?

1 Like