Snappy intalation problems with python 3.10

Good morning SNAP community,

I’m trying to configure the Snappy library in Python, but I’m unable to make it work. I hope you can assist me with this. I have SNAP 9, Python 3.10, and I’m working on Windows 10. I’ve installed the Snappy 9.0 library in Python, but when I import it, I encounter an error while trying to initialize the JVM. Here’s the output from the terminal during the installation and the library import:

S C:\Windows\system32> cd C:\Users\VNavarro\.snap\snap-python\esa_snappy\snappy
PS C:\Users\VNavarro\.snap\snap-python\esa_snappy\snappy> python install
running install
C:\Program Files\Python310\lib\site-packages\setuptools\command\ SetuptoolsDeprecationWarning: install is deprecated. Use build and pip and other standards-based tools.
C:\Program Files\Python310\lib\site-packages\setuptools\command\ EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
running bdist_egg
running egg_info
creating snappy.egg-info
writing snappy.egg-info\PKG-INFO
writing dependency_links to snappy.egg-info\dependency_links.txt
writing top-level names to snappy.egg-info\top_level.txt
writing manifest file 'snappy.egg-info\SOURCES.txt'
reading manifest file 'snappy.egg-info\SOURCES.txt'
writing manifest file 'snappy.egg-info\SOURCES.txt'
installing library code to build\\egg
running install_lib
running build_py
creating build\
creating build\\egg
creating build\\egg\snappy
copying build\lib\snappy\jdl.cp310-win_amd64.pyd -> build\\egg\snappy
copying build\lib\snappy\jpy.cp310-win_amd64.pyd -> build\\egg\snappy
copying build\lib\snappy\ -> build\\egg\snappy
copying build\lib\snappy\ -> build\\egg\snappy
copying build\lib\snappy\ -> build\\egg\snappy
copying build\lib\snappy\ -> build\\egg\snappy
copying build\lib\snappy\snappy.ini -> build\\egg\snappy
copying build\lib\snappy\ -> build\\egg\snappy
copying build\lib\snappy\ -> build\\egg\snappy
byte-compiling build\\egg\snappy\ to jpyconfig.cpython-310.pyc
byte-compiling build\\egg\snappy\ to jpyutil.cpython-310.pyc
byte-compiling build\\egg\snappy\ to setup.cpython-310.pyc
byte-compiling build\\egg\snappy\ to snappyutil.cpython-310.pyc
byte-compiling build\\egg\snappy\ to __init__.cpython-310.pyc
creating build\\egg\EGG-INFO
copying snappy.egg-info\PKG-INFO -> build\\egg\EGG-INFO
copying snappy.egg-info\SOURCES.txt -> build\\egg\EGG-INFO
copying snappy.egg-info\dependency_links.txt -> build\\egg\EGG-INFO
copying snappy.egg-info\top_level.txt -> build\\egg\EGG-INFO
writing build\\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
snappy.__pycache__.__init__.cpython-310: module references __file__
snappy.__pycache__.jpyutil.cpython-310: module references __file__
snappy.__pycache__.setup.cpython-310: module references __file__
snappy.__pycache__.snappyutil.cpython-310: module references __file__
creating dist
creating 'dist\snappy-9.0.0-py3.10.egg' and adding 'build\\egg' to it
removing 'build\\egg' (and everything under it)
Processing snappy-9.0.0-py3.10.egg
creating c:\program files\python310\lib\site-packages\snappy-9.0.0-py3.10.egg
Extracting snappy-9.0.0-py3.10.egg to c:\program files\python310\lib\site-packages
Adding snappy 9.0.0 to easy-install.pth file

Installed c:\program files\python310\lib\site-packages\snappy-9.0.0-py3.10.egg
Processing dependencies for snappy==9.0.0
Finished processing dependencies for snappy==9.0.0
PS C:\Users\VNavarro\.snap\snap-python\esa_snappy\snappy> python
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 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 "C:\Program Files\Python310\lib\site-packages\snappy-9.0.0-py3.10.egg\snappy\", line 236, in <module>
SystemError: <built-in function create_jvm> returned a result with an exception set

I greatly appreciate your assistance.

Please have a look at the solutions provided in this topic:

Thanks Diana!
The solution wasn’t exactly that, but it helped me a lot. Finally, the combination of versions that allowed me to install Snappy in my virtual environment was Python 3.8 and jpy 0.9.0.

I’m stuck using snappy on version 3.6.8 of python which is end of life, how are we supposed to programmatically talk to snap since python appears not supported?
Surely there are some other alternatives that i have missed? Even jumping through hoops to get to 3.8 doesn’t really seem practical as that is very out of date too.
What does everyone else use, unfortunately most of my code is python now so it would be a big effort to switch to something else, but currently seems like a dead end.

Any suggestions or there?

It seems that with version 10 of SNAP, not so many acrobatics will be necessary. For now, with Python 3.8 and SNAP 9.0, it works well.
In my case, the solution came from generating the wheel from my machine with GitHub - bcdev/jpy: A bi-directional Python-Java bridge used to embed Java in CPython or the other way round.