AttributeError: module 'jpy' has no attribute 'has_jvm'

I am trying to use snappy in Python 3.6 within Anaconda 3 (Spyder). Upon installation of snap, I selected the correct python version. When I ran ‘import snappy’, I first got the error ‘ModuleNotFoundError: No module named ‘jpyutil’’. I then changed ‘import jpyutil’ to ‘from jpy import jpyutil’ in the file (which may have been a bad idea). Now, I get the following error message:

AttributeError: module ‘jpy’ has no attribute ‘has_jvm’

Maybe you did not add this before the snappy import.

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

See the ‘Configure python’ section on this page: Configure Python to use the SNAP-Python snappy interface

@bfelten were you able to solve this error? I am facing the same using python 3.7 on ubuntu 18.

In case you have Windows os, it’s not possible to configure snappy with any of pythons’ versions, except of py27 and py34, for more details please take a look at the following thread,

Source of the thread

Concerning Linux I think it’s possible, take a look at the following thread,

Source of the thread

I have managed to configure snappy on Windows with python 3.6 as I said in this thread:

Numpy, snappy and python 3.4

Actually, for me I did all the trials are mentioned, but I didn’t get any conf. Results, I also found during the SNAP installation, it’s recognizing py27 and py34 automatically , without to navigate to the py folder.

Hello Marpet,
I work with OS Catalina and I’m trying to install snappy module. I solved a lot of issues following your suggestions in other topics but now I have no idea about how to solve it.
when I import snappy, this is what happens:

import sys
import snappy
Traceback (most recent call last):
File “”, line 1, in
File “/Users/lorenzogiulianopapale/.snap/snap-python/snappy/”, line 234, in
called_from_java = jpy.has_jvm()
AttributeError: module ‘jpy’ has no attribute ‘has_jvm’

I tried with sys.path append and sys.path.insert but I cannot go through it.
I wait for your kind reply.

This error happens because there is no attribute with the name you called, for that Object. This means that you got the error when the “module” does not contain the method you are calling. But it is evident that the method is there, which leads to believe that may be the method was added by you in the python source code after you had already imported the file (module). Or, some times packages get deprecated and they rename some functions. If that is true, then you may want to exit and reimport the module once again to be able to access the new method.

You can do it in another way to reimport the module with changes without having to exit the interpreter is to do the following:

import importlib