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}-cp38-{abi_tag}-macosx_10_14_x86_64.whl' could be found.
You can try to build a 'jpy' wheel yourself, then copy it into
"/Users/floriane/.snap/snap-python/snappy", and then run the configuration again.
Unzip the jpy sources in /Users/floriane/.snap/snap-python/snappy/jpy-<version>.zip, then
$ cd jpy-<version>
$ python setup.py bdist_wheel
$ cp dist/*.whl "/Users/floriane/.snap/snap-python/snappy"
Or get the source code from https://github.com/bcdev/jpy and follow the build instructions:
$ git clone https://github.com/bcdev/jpy.git
$ cd jpy
ERROR: Configuration failed with exit code 10
I did the fist step, but it gets stuck here : âpython setup.py bdist_wheelâ
You appear to have python 3.7 on a directory in your PATH variable, but used python 3.8 with ./snappy-conf /usr/bin/python3
The screen capture shows python 3.7.7, but omits the path, so we donât know where this python is installed. The you use /usr/bin/python3 ./snappyutil.py. The log file says:
The -cp38- indicates that /usr/bin/python3 is version 3.8. You need to find the python 3.7 location and use the full path with snappy-conf and any scripts that use snappy. Note that Linux users often told to adjust their PATH variable, but Apple reserves the PATH variable for âsystemâ programs and tells us to use the full path for non-system programs. You may find other programs failing when they find python 3.7 when they expect python 3.8.
Thanks for your answerâŚ
Ok, I change the PATH with Python3.7, and I have the same error ⌠with -cp37 âŚ
ERROR: The module 'jpy' is required to run snappy, but no binary 'jpy' wheel matching the pattern
'jpy-{version}-cp37-{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/floriane/.snap/snap-python/snappy", and then run the configuration again.
Unzip the jpy sources in /Users/floriane/.snap/snap-python/snappy/jpy-<version>.zip, then
$ cd jpy-<version>
$ python setup.py bdist_wheel
$ cp dist/*.whl "/Users/floriane/.snap/snap-python/snappy"
Or get the source code from https://github.com/bcdev/jpy and follow the build instructions:
$ git clone https://github.com/bcdev/jpy.git
$ cd jpy
ERROR: Configuration failed with exit code 10
The error here is : src/main/c/jni/org_jpy_PyLib.c:331:9:error:implicit declaration of function âJPy_freeâ is invalid in C99 [-Werror,-Wimplicit-function-declaration]
GCC and XCode are well installed. Maybe do you have an idea to resolve this problem ?
Thank you very much !!
Generally, macOS software uses clang, not gcc. If you have the CC=gcc in your environment or python built using gcc that could explain why gcc is used by setup.py. You should check which compilers were used to build your JDK and python 3.7 (this should be mentioned in the documentation (OpenJDK Build Instructions say clang is used for on macOS), but may not mention versions. Appleâs otool will show you which libraries are linked by python and javaâs jvm. Third party software is often built on older macOS versions and will run on newer versions but can have problems if you then build extensions on the newer system.
It might be helpful to others if you can post a summary of the key steps needed to configure ESA SNAP snappy on your macOS version. From the information in this thread, it seems the instructions SNAP provides (when snappy-util.py fails and the README.md file that comes with jpy) are correct, but assume the reader is an experienced Python and Java developer on their platform. To me it seems the key stumbling points were ensuring that setup.py was run with python 3.7 then Iâm guessing you needed to get setup.py to use Appleâs clang compiler.
It would be good to mention where you got Python 3.7 (e.g., Apple, Python.org, macports, homebrew, anaconda, or ??) as this may affect the choice of compiler (clang versus gcc).
I assume this is a typo for export CC=/usr/local/bin/gcc.
I had the same issue. Since I donât have gcc installed, I added the line void JPy_free(); to the top of src/main/c/jni/org_jpy_PyLib.c, and then clang compiled correctly. Note: I used anaconda python, and some things with brew.
Note: make sure to run the python setup.py install command.
Some notes on a further issue I had that I want to dump in case itâs helpful to anyone.
After I installed when trying to import the library, I got the following output:
`Python 3.6.13 | packaged by conda-forge | (default, Sep 23 2021, 07:55:15)
[GCC Clang 11.1.0] on darwin
Type âhelpâ, âcopyrightâ, âcreditsâ or âlicenseâ for more information.
import snappy
No Java runtime present, requesting install.`
I have Python 3.6.8 from Python.org, an M1 Mac with Big Sur 11.2.2 & SNAP 8.0
I tried the CC=/usr/local/bin/gcc but that gave a new set of error: unable to execute â/usr/local/bin/gccâ: No such file or directory error: command â/usr/local/bin/gccâ failed with exit status 1
So I looked in my /usr/local/bin folder and I donât have a gcc file but I do have a gcc-11 but that didnât work
Then I tried this video to make gcc-11 (homebrew gcc) be the main gcc (instead of clang gcc) as per this youtube video but that didnât work either Install GCC/G++ on MacOS arm64 M1 Mac - YouTube
I added void JPy_free(); to the top of src/main/c/jni/org_jpy_PyLib.c
and I still get the gcc error
I feel like Iâve tried almost all the solutions proposed but Iâm not sure what else to try or maybe if I tried too many solutions at the same time? Any help would be greatly appreciated.
My goal is to use snappy with other packages in python to automate some sentinel-1 snap processing.
Using the M1 processor make your job more complicated. The SNAP software currently uses Intel binaries, so runs under rosetta. Both Python and jpy need to be built for Intel architecture with compatible compiler versions. There are reports of failures with Python 3.6.8 from Python.org on recent MacOS versions because Python 3.6.8 was built on a much older macOS version.
Building a Universal MacOS Binary shows how to build Intel binaries using X-code (universal binaries are created by combining Intel and M1 binaries, but you just need Intel binaries).
You will probably need to use gcc, but you may need to specifically install a version that generates Intel
binaries (some may only generate M1 binaries).
You donât mention your JDK version. You should install Intel macOS openjdk-8.jdk as mentioned in previous posts. There are many sources for gcc and openjdk-8.jdk, so you will have to check the one you use to make sure it can generate Intel binaries (there may be arguments to select the target architecture).