Snappy processing error

hi everyone,I have installed snappy ,but when I run my program in pycharm ,there is somthing wrong. The error is like that displaying in image, I have been troubled by this problem for sevral days,who can help me please!

It would be easier to respond if you had posted as text, and others with the same problem you be able to find your post.

RuntimeError: jpy: internal error:static method not found: ...

can occur when mixing jpy and Python built using different C++ compilers. Does snappy work when with python running in a terminal?

If the problem only occurs using PyCharm, there may be a PyCharm setting that helps.

Thank u so much for your advise,I try to use snappy in terminal,unfortunately, the error still exist.
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 “”, line 1, in
File “C:\Python34\Lib\site-packages\snappy\snappy_init_.py”, line 236, in
jpy.create_jvm(options=_get_snap_jvm_options())
SystemError: returned a result with an error set

You will need to configure ESA SNAP snappy.

Note that there are several other Python “snappy” packages, so the usual installation methods such as pip will generally install the wrong snappy package. It is safest to use "append <snappy-dir> to the sys.path variable in your Python code before importing snappy" from the configuration document in your Python scripts. I find this is helpful when sharing scripts with others as it avoids confusion with other snappy packages.

@gnwiii do you have a code example for "append " that you could share? I haven’t seen this before.

I was referring to the section that contains:

import sys
sys.path.append('<snappy-dir>') # or sys.path.insert(1, '<snappy-dir>')
import snappy

from the wiki document (configure ESA SNAP snappy). Actually, it is better to use insert method in case a different package called snappy has been installed.

1 Like

I didnt install the snappy which has the same name with snappy of SNAP by pip,I try to use the way u posted to run my program, the message of error dosent change.I gusess that it may be related with the JAVA enviorment.Anyway, thanks for ur suggestion.

This shows a “snappy” package installed in Python34. It may have been installed “secretly” as a requirement of some other package. You need to verify that your <snappy-dir>" ("%USERPROFILE%\snap\snap-python\snappy") package is working. If so, use sys.path.insert(1, ''in your python scripts to ensure you are not usingC:\Python34\Lib\site-packages\snappy`.

I applied the way u said,and this is my test program:


import sys
sys.path.append(r’C:\Users\lilin\Anaconda\Anaconda3\envs\py36\Lib\sitepackages\snappy’)
import snappy
from snappy import ProductIO
file_path = r’C:\Users\lilin\Anaconda\Anaconda3\envs\py36\Lib\sitepackages\snappy\testdata\MER_FRS_L1B_SUBSET.dim’
p = ProductIO.readProduct(file_path)
list(p.getBandNames())


the message of error doesn’t change
C:\Users\lilin\anaconda3\envs\pythonnew\python.exe C:/Users/lilin/PycharmProjects/pythonProject5/test.py
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 “C:/Users/lilin/PycharmProjects/pythonProject5/test.py”, line 3, in
import snappy
File “C:\Python34\Lib\site-packages\snappy\snappy_init_.py”, line 236, in
jpy.create_jvm(options=_get_snap_jvm_options())
SystemError: returned a result with an error set

Process finished with exit code 1

Since you appear to have a package called “snappy” installed in the default python path you need to insert the entry for ESA SNAP snappy:

sys.path.insert(1, r'C:\Users\lilin\Anaconda\Anaconda3\envs\py36\Lib\sitepackages\snappy')`

Note that if you want to share your scripts with other users, the USERPROFILE environment variable can be used as described in the wiki document (configure ESA SNAP snappy ).

Thank u so much,I uninstalled the default python,and deleted the package of it,so the problem has been sloved.

Glad ESA SNAP snappy is working for you. I think there are plans to change the name from snappy to something less popular (searching for “snappy” on PyPi gets well over 100 packages now), but you may encounter a conflict if you install some other python package that depends on one of the other “snappy” packages.

1 Like