Out-of-the-box support on Python 3.7 or above for snappy after Python 3.6 End of Life (on Dec 21)

Hello,

I have realised that Python 3.6 reached is End of Life support on Dec 21 ( Python | endoflife.date).

Is there any plan to provide direct support of snappy for Python 3.7, 3.8 or 3.9?

Thanks in advance for any information.
Fernando

Hi
currently only 3.6 is supported.
Here is a thread where at the end it was possible to use Python 3.8.
Fail python configuration on ubuntu and python 3.8 - development / python - STEP Forum (esa.int)

But support for recent Python versions is planned but I can’t give you a schedule yet.

Depending on you use case snapista is another option.
Introducing snapista, a GPT wrapper for Python - Show Room - STEP Forum (esa.int)

Thanks for the suggestion. In any case, notice that at least the latest version of VSCode Python dev plugin has dropped the support for Python 3.6 and some functionalities as the debugger does not work anymore with Python 3.6.

I will try to build jpy on my own.

Best regards,
Fernando

You could try one of the bnary wheels for jpy-0.11 from PyPI.

Actually, I tried to run

pip install jpy

but I think that this is not enough since snappy still does not work.

Python 3.8.13 (default, Mar 28 2022, 11:38:47)
[GCC 7.5.0] :: Anaconda, Inc. on linux
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 "/home/user/.snap/snap-python/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

Probably, the key is in this error:
RuntimeError: jpy: internal error: static method not found: unwrapProxy(Ljava/lang/Object;)Lorg/jpy/PyObject;

when creating the jvm in line 326 of init.py: jpy.create_jvm(options=_get_snap_jvm_options())

Regards,
Fernando

I guess that leaves you with building a jpy binary wheel for python 3.8. This has been difficult for
users who are new to linux (you can try to follow some previous threads in this forum). In addition to the problem with the many x86_64 “snappy” conda packages for Python on linux, there can be conflicts with Ubuntu’s “SNAP” system.

Configure Python to use the SNAP-Python (snappy) interface has a link to the jpy readme document with build instructions for linux.
These do work if you are careful to avoid conflicts and have a normal user install of ESA SNAP.

Thanks for your response @gnwiii.

However, I have finally found a pretty easy solution! In case someone else is affected see below my solution.

Steps:

  1. Download the file at https://anaconda.org/Terradue/jpy/0.9.0/download/linux-64/jpy-0.9.0-py38_3.tar.bz2 (Jpy 0.9.0 for Python 3.8 provided at Anaconda by Terradue at Files :: Anaconda.org)

  2. Extract the files as tar xvjf jpy-0.9.0-py38_3.tar.bz2. Now, you will have the whl in your computer.

  3. Run the command ./snappy-conf <python3.8 location> . The command will fail.

  4. Copy the whl file in the ~/.snap/snap-python/snappy/

  5. Run again the command ./snappy-conf <python3.8 location>. Everything will work.

My conclusion is that jpy 0.11.0 (at least the whl provided at Release v0.11.0 · jpy-consortium/jpy · GitHub) has some problem with snappy code or ESA Snap, since it seems that it has a problem with the object “unwrapProxy”. However, jpy 0.9.0 (compilation for Python 3.8 provided by Terradue) works without issues.

@Ferni here’s the github repo with the jpy conda recipe: GitHub - snap-contrib/jpy-conda: jpy as a conda package - required by snap-conda
It may help you or others