Difficulty in loading snappy modules

Hello Marpet,
I have a windows 10 operating system with 8 GB RAM, with Anaconda 3.7 version installed on my computer. I installed snappy using conda command, but running the following command shows import error:

from snappy import ProductIO gives an error.

ImportError: cannot import name ‘ProductIO’ from ‘snappy’ (F:\Python\Anaconda_3.0\envs\gdal_env\lib\site-packages\snappy_init_.py)

After going through topics related to snappy in step forum, I reinstalled SNAP software with python 3.6 version.Then in the SNAP command line, I gave the following command-
**snappy-conf.bat F:\python3.6\python-3.6.0.exe

and the following errors were displayed.

The launcher has determined that the parent process has a console and will reuse it for its own console output.
Closing the console will result in termination of the running program.
Use ‘–console suppress’ to suppress console output.
Use ‘–console new’ to create a separate console window.
Configuring SNAP-Python interface…
java.io.IOException: SNAP-Python configuration incomplete.
Missing file ‘C:\Users\Such.snap\snap-python\snappy\jpyconfig.properties’.
Please check the log file ‘C:\Users\Such.snap\snap-python\snappy\snappyutil.log’.
at org.esa.snap.python.PyBridge.installPythonModule(PyBridge.java:152)
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(Thread.java:748)
Python configuration error: SNAP-Python configuration incomplete.
Missing file ‘C:\Users\Such.snap\snap-python\snappy\jpyconfig.properties’.
Please check the log file ‘C:\Users\Such.snap\snap-python\snappy\snappyutil.log’.

How can I solve this issue.

Thank you

this indicates that your python instance could search for snappy in the wrong environment (gdal_env).

Can you please post the exact command you entered to install snappy?

In Anaconda navigator, I have searched the snappy module and installed it directly through the navigator by selecting the environment " gdal_env".

I don’t think this is the correct one - it probably refers to this one: python-snappy · PyPI
So I would first delete this from the environment in a first step.

Then, please follow the instructions here: https://senbox.atlassian.net/wiki/spaces/SNAP/pages/50855941/Configure+Python+to+use+the+SNAP-Python+snappy+interface
It is important that you refer to the python.exe inside the gdal-env you created to SNAP knows where to place the snappy libraries.

As @ABraun mentioned, you have encountered one of the many Python packages named “snappy” that are not from ESA SNAP. The link to the ESA SNAP Python interface (also called “snappy”) mentions several ways to import ESA SNAP snappy. For most users, it is best to "append <snappy-dir> to the sys.path variable in your Python code before importing snappy". If you install ESA SNAP snappy to site-packages other python programs that expect one of the other snappy modules may fail. By appending <snappy-dir> to the sys.path variable in your Python code you are making it clear to anyone who looks at your code that you code requires ESA SNAP snappy.

I have installed SNAP, where can I find the path.

You have selected it yourself during the installation .
You can also select SNAP in the start menu ansright click>open folder

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ESA SNAP
Is this the path for snappy?
For appending <snappy-dir> to the sys.path variable in Python code, I need to know the path of snappy-dir, So where can I find it.

I followed the link below and found path for snappy, but its giving error

this is just the shortcut to SNAP in the start menu. Please go to the properties of the SNAP executable to check its actual origin.

Please post error messages as text – screen captures can’t be searched are used to cut and paste.

If you are planning to use python you will need to learn the language. Python treats a \ as an “escape” character, so you need to replace \ with \\. You can usually use a forward (/) slash as the separator in paths (but beware of cases where the path is passed to Windows). Python code is quite portable across
Windows, Linux, and macOS, so it is generally best to use / as a path separator.

Thank you @gnwii for reminding me this. I have tried with \ and \ also. But no improvement.

I again created a new environment snap_env with python=3.6. I followed the commands given by @ABraun in the SNAP command line.

snappy-conf F:\Python\Anaconda_3.0\envs\snap_env_v36\python.exe

The launcher has determined that the parent process has a console and will reuse it for its own console output.
Closing the console will result in termination of the running program.
Use ‘–console suppress’ to suppress console output.
Use ‘–console new’ to create a separate console window.
Configuring SNAP-Python interface…
java.io.IOException: Python configuration failed.
Command [F:\Python\Anaconda_3.0\envs\snap_env_v36\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 --jvm_max_mem 5G --java_home “C:\Program Files\snap\jre\jre” --req_arch amd64]
failed with return code 30.
Please check the log file ‘C:\Users\Suchitra.snap\snap-python\snappy\snappyutil.log’.
at org.esa.snap.python.PyBridge.configureJpy(PyBridge.java:232)
at org.esa.snap.python.PyBridge.installPythonModule(PyBridge.java:149)
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(Thread.java:748)
Python configuration error: Python configuration failed.
Command [F:\Python\Anaconda_3.0\envs\snap_env_v36\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 --jvm_max_mem 5G --java_home “C:\Program Files\snap\jre\jre” --req_arch amd64]
failed with return code 30.
Please check the log file ‘C:\Users\Suchitra.snap\snap-python\snappy\snappyutil.log’.

Any help to solve the issue is highly appreciable.

There have been previous reports of error 30 from snappy-conf. Usually snappyutil.log gives a more specific message.

Did you activate the Python snap_env_v36 environment before running snappy-conf?

What do you get for python --version with snap_env_v36 activated?