Jpy does not define module export function

Hi,
I’m trying to install snappy on a Debian 10 machine.
I defined JDK_HOME & JAVA_HOME to JDK dir
I defined LD_LIBRARY_PATH to the libjvm.so dir

I manually installed jpy and transferred the wheel to ~/.snap/snap-python/snappy
I ran snappy-conf with my default python (/usr/bin/python)
The terminal never finished but I got the “Done. The SNAP-Python…” in the snappyutil.log file

I than tested the installation by typing “import snappy” in a python session and got
ImportError: dynamic module does not define module export function (PyInit_jpy)
The only jpy module I have is in side the folder (tested by exiting and searching for all available modules)

I did got a warning message in the snappyutil.log
Warning: Architecture requirement possibly not met: Python is x86_64 but JVM requires amd64
but since it didn’t fail and the probleme seems to be in the jpy.so code I don’t think it is the root cause.

What can I do?
Thank you

This Stackoverflow post mentions several things that can cause this error.

If that doesn’t help, you should provide more details:

What do you mean by “manually installed jpy”? Did you build jpy using maven? There are several jpy versions on the internet – which did you use?

Which JDK did you use? Debian 10 provides several versions of openJDK and there are old Oracle JDK’s from before the license change.

Thank you for the reference, a comment there helped me.
When import snappy I get a SEVERE log message

The environment variable LD_LIBRAY_PATH does not contain the current folder ‘.’

I found a post with the same problem siting the reason in another link, but the link inside no longer work to

For sake of completeness, this is the process I did:
I used OpenJDK 8, a version the docs say is supported
I forked the latest version of jpy from github (0.9) and built it with maven3.6.
Don’t know why, version 0.10 of the wheel got built (in /dist)
I installed (pip install jpy.whl) the package
running ./snappy-conf builds the snappy module with jpy inside but thanks to this comment from stackoverflow (from the post gnwiii mentioned) I understood the problem:

initfizzbuzz is the python2 naming scheme, python3 needs PyInit_libfizzbuzz . So if you know your library is built for python3 and you get the error msg. in in the original question, probably some python2 interpreter got into the way.

Apparently the snappy-conf includes the jpy, no need to manually install. But for some reason (maybe I installed SNAP with python2.7?) it compiles jpy for py2.7 and not py3
I solved the issue by REMOVING all jpy related files from snappy module so to default to the module installed in site-packages, I hope this does not bite me later on.

SNAP includes linux jpy wheels for Python 2.7, and 3.3 to 3.6, see How to use the SNAP API from Python.

Python 2.7 “end-of-life” is scheduled for 2020, so Debian 10 has focused on Python 3. Python 3.6 is schedules to get security fixes until 2012-12. If you are running snappy with Python 2.7 on Debian 10 and need 3rd party packages you may find that some packages are no longer available for Python 2.7. There is also the problem that scripts you write for python 2.7 will usually need changes for python 3.x. With care, many scripts can be written so they run on either 2.7 or 3.6.

You should test your installation as described in the “how to” document and by running the snappy examples and tests.

Debian 10 provides the current Python 3.8, but you should be able to use an
Anaconda Python 3.6 environment if you have problems with 2.7.

I think you miss understood me
I’m using Python3.8, for some reason the installer (./snappy-config) used the python2.7 wheel instead.
My problem now is the warning messeage I cited. From a previous comment of yours I understand it is some kind of meaningless bug.

SNAP provides a number of jpy wheels. The wheel it selects should match the Python version and architecture, but there is an ambiguity between amd64 and x86_64, two names for the same hardware architecture. Maybe if you provide a Python version like 3.8 for which SNAP does not have a jpy wheel it will look for an earlier version.

The message:

Warning: Architecture requirement possibly not met: Python is x86_64 but JVM requires amd64

just means that Python and the JVM use different names for the same architecture.

The LD_LIBRARY_PATH message is related to GDAL and can be ignored unless you have a problem using Java GDAL writers.

Thank you for all the help and explanations