[WinError 126] when configuring Snappy (snappy-conf)

The snappy-conf.bat throws error in the verbose log:

failed with return code 30.
Please check the log file 'C:\Program Files\Python36\Lib\site-packages\snappy\snappyutil.log'.
        at org.esa.snap.python.PyBridge.configureJpy(PyBridge.java:223)
        at org.esa.snap.python.PyBridge.installPythonModule(PyBridge.java:147)
        at org.esa.snap.rcp.cli.SnapArgsProcessor.processPython(SnapArgsProcessor.java:103)
        at org.esa.snap.rcp.cli.SnapArgsProcessor.process(SnapArgsProcessor.java:49)
        at org.netbeans.modules.sendopts.DefaultProcessor.process(DefaultProcessor.java:202)
        at org.netbeans.spi.sendopts.Option$1.process(Option.java:387)
        at org.netbeans.api.sendopts.CommandLine.process(CommandLine.java:317)
        at org.netbeans.modules.sendopts.HandlerImpl.execute(HandlerImpl.java:62)
        at org.netbeans.modules.sendopts.Handler.cli(Handler.java:69)
        at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
        at org.netbeans.core.startup.CLICoreBridge.cli(CLICoreBridge.java:82)
        at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:234)
        at org.netbeans.CLIHandler$1.exec(CLIHandler.java:268)
        at org.netbeans.CLIHandler.finishInitialization(CLIHandler.java:447)
        at org.netbeans.MainImpl.finishInitialization(MainImpl.java:256)
        at org.netbeans.Main.finishInitialization(Main.java:92)
        at org.netbeans.core.startup.Main.start(Main.java:316)
        at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
        at java.lang.Thread.run(Unknown Source)
Python configuration error: Python configuration failed.
Command ["C:\Program Files\Python36\python.exe" .\snappyutil.py --snap_home "C:\Program Files\snap" --java_module "C:\Program Files\snap\snap\modules\org-esa-snap-snap-python.jar" --force --log_file .\snappyutil.log --java_home "C:\Program Files\snap\jre" --req_arch amd64]
failed with return code 30.
Please check the log file 'C:\Program Files\Python36\Lib\site-packages\snappy\snappyutil.log'.

Error logged in the snappyutil.log is:

ERROR: Configuration failed
Traceback (most recent call last):
  File ".\snappyutil.py", line 261, in _main
    force=args.force)
  File ".\snappyutil.py", line 210, in _configure_snappy
    __import__('snappy')
  File "C:\Program Files\Python36\Lib\site-packages\snappy\..\snappy\__init__.py", line 63, in <module>
    jpyutil.preload_jvm_dll()
  File "C:\Program Files\Python36\Lib\site-packages\snappy\jpyutil.py", line 344, in preload_jvm_dll
    return ctypes.CDLL(jvm_dll_file, mode=ctypes.RTLD_GLOBAL)
  File "C:\Program Files\Python36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

How can I fix it? Any help will be appreciated. Thanks

Try with an older Python version. Python is supported till version 3.4. Above it might work, or not.

@marpet Thanks for the heads up. But it works with python 3.6. I use snappy with python 3.6 in my personal laptop and it works fine. There was no error at the time of configuration as well.

Mmm?? Yes it can work, but it is not guaranteed. At least I haven’t tried.
Do you use a different SNAP version on your laptop?
Maybe it helps, if you delete the .snap directory in your home folder.

No, I use the same snap version in my laptop. Only thing is that my laptop runs on Linux x64.

I confirm that it doesn’t work with python36, as mentioned in the docs but it works on python34.
With python36 I get the following error when I try to import snappy:

import jpy ImportError: Module use of python34.dll conflicts with this version of Python.

It’s not an issue for me to work on python34 but I’m just wondering (the end-of-life for Python 3.4 is March 2019), is it because of jpy that snappy wasn’t upgraded to support python36?

In my case it does work. See:

Which version of jpy did you install? There is a release of jpy v0.9.0(jpy-0.9.0-cp36-cp36m-win_amd64.whl) for python 3.6. You can check out all the releases of jpy here: https://github.com/bcdev/jpy/releases

I confirm that both jpy and snappy are now working for me on Python-3.6.5.

Hello, I have the same issue. I am using Python 2.7 and SNAP 6.0. The snappyutil.txt file looks as follows:

Any help will be greatly appreciated. Thanks

It could be that not all pieces share the same bitness.
As you are on a 64-bit system all software should be 64 bit. Maybe the Python instance you have is only 32-bit.
Could you check this, please?

Hello marpet, thanks for your swift reply! I am using Anaconda 2 64-Bit and the Windows 64-Bit version of SNAP with all toolboxes.

I don’t really know what is wrong. It must be something with the DLL of the JVM.
It is named jvm.dll and is usually located in “C:\Program Files\snap\jre\bin\server”. It seems that it is found but cannot be loaded. For whatever reason.

the problem is that jpyconfig is wrongly created, so for example if JDK_HOME is C:\Program Files\Java\jdk1.8.0_241
in jpyconfig.py the jvm_dll variable is set to C:\Program Files\Java\jdk1.8.0\jre\bin\server\jvm.dll
so it is missing “_241”, the bug needs to be fixed in jpy project but a workaround would be to go to jpyconfig.py file and set right jvm_dll manually or just use a JDK_HOME without underscores