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 setup.py install
running install
C:\Program Files\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
C:\Program Files\Python310\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
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\bdist.win-amd64\egg
running install_lib
running build_py
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\jdl.cp310-win_amd64.pyd -> build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\jpy.cp310-win_amd64.pyd -> build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\jpyconfig.properties -> build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\jpyconfig.py -> build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\jpyutil.py -> build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\setup.py -> build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\snappy.ini -> build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\snappyutil.py -> build\bdist.win-amd64\egg\snappy
copying build\lib\snappy\__init__.py -> build\bdist.win-amd64\egg\snappy
byte-compiling build\bdist.win-amd64\egg\snappy\jpyconfig.py to jpyconfig.cpython-310.pyc
byte-compiling build\bdist.win-amd64\egg\snappy\jpyutil.py to jpyutil.cpython-310.pyc
byte-compiling build\bdist.win-amd64\egg\snappy\setup.py to setup.cpython-310.pyc
byte-compiling build\bdist.win-amd64\egg\snappy\snappyutil.py to snappyutil.cpython-310.pyc
byte-compiling build\bdist.win-amd64\egg\snappy\__init__.py to __init__.cpython-310.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying snappy.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying snappy.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying snappy.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying snappy.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\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\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\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\__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 exception set
>>>

I greatly appreciate your assistance.

Please have a look at the solutions provided in this topic:
https://forum.step.esa.int/t/problems-with-snappy-and-python-3-8/36833

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.