Hi everyone. I’m having issues when trying to configure SNAP 10 with Python 3.9.13 on Windows 11 (version 23H2). The text from the cmd is shown below:
Microsoft Windows [Version 10.0.22631.3447]
(c) Microsoft Corporation. All rights reserved.
C:\Users\user>cd C:\Program Files\esa-snap
C:\Program Files\esa-snap>snappy-conf C:\Users\user\AppData\Local\Programs\Python\Python39\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.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.netbeans.ProxyURLStreamHandlerFactory (file:/C:/Program%20Files/esa-snap/platform/lib/boot.jar) to field java.net.URL.handler
WARNING: Please consider reporting this to the maintainers of org.netbeans.ProxyURLStreamHandlerFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Configuring ESA SNAP-Python interface...
Configuration failed!
Error: Python configuration error
Full stack trace:
C:\Program Files\esa-snap>
Two things to note: I’m not getting an error code, and the full stack trace is blank. Both of these made it very difficult for me to know how to fix this. I also couldn’t find any previous post that discussed this issue.
I’ve tried reinstalling both SNAP and Python, but it didn’t help.
Some additional information:
I don’t have other versions of Python nor SNAP installed.
I have 16 GB RAM so I’m running on a 64-bit OS.
The installed Python and SNAP are both 64-bit versions.
I’ve checked that the Python path is in the environment variables.
I’m running the cmd or the SNAP command line “as administrator”
This is my first post on this forum. I’ve tried to read the guidelines and include all (hopefully) relevant information, but please let me know if I forgot to mention anything.
thanks for reporting this. We reproduced the problem on Windows 11 with Python versions >= 3.8, including the 3.9.13 you are using. It seems that the problem is Win11-specific, as on Windows 10 esa_snappy obviously works without problems for Python versions up to 3.10 as it should.
We will further investigate the issue. For the moment we can only recommend to use Python max. 3.7.x if on Win11, or to move to Win10 if possible. We are sorry for the inconvenience.
I installed JDK (from here Java Downloads | Oracle or from here OpenJDK JDK 22.0.1 GA Release) and set the environmental system variables “JAVA_HOME” to “C:\jdk-22.0.1” and added “C:\jdk-22.0.1\bin” to the Path variable
Hi, congratulations and thanks a lot for sharing this. However, this procedure is way too complicated. In the end, installation should be as simple as we described for Win10. As said, we’ll work on this issue and check for incompatibilities.
Hi again, I had a closer look, and there might be a simple solution:
I noticed that during the first test run, as reported two days ago, I had (by accident) environment variables PYTHONHOME and PYTHONPATH pointing to a Python version different to the one I was trying to use with esa_snappy. Given this, I got exactly the same error as you did, with empty stack trace from snappy-conf. So perhaps the same applies on your side?
After removing PYTHONHOME and PYTHONPATH, everything is now working fine. It is ok, however, if the Python you are using for esa_snappy is on the standard ‘Path’ variable. It is also ok if you have other Pythons installed on your system, but don’t use them in any environment variables.
When I copy the esa_snappy folder into the python environment site-packages folder and try to import esa_snappy, the jpyutil file fails to load. I actually can’t find the jpyutil.py file anywhere on my computer. Does this mean the installation is incomplete?
I’m running Win 10. I don’t have PYTHONHOME or PYTHONPATH at all. I’ve also taken all Python references out of my PATH variable. I am running the above command in a conda environment which worked fine for Snap 9
Hi, I’m using Python 3.10.13 in anaconda environment (windows 11). When installing SNAP, i tickled the box for autmatic config. But I still cannot use the snappy library. Please help me, I am really new to this
C:\Program Files\esa-snap\bin>snappy-conf C:\Users\niput\anaconda3\envs\snapenv\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.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.netbeans.ProxyURLStreamHandlerFactory (file:/C:/Program%20Files/esa-snap/platform/lib/boot.jar) to field java.net.URL.handler
WARNING: Please consider reporting this to the maintainers of org.netbeans.ProxyURLStreamHandlerFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Hello to everyone. I’ve got problem on the configuration of esa-snappy for Python. First of all, during the installation of SNAP software I enable Python for SNAP, I indicate the correct path for the python.exe to use, but it seems like this operation doesn’t happen.
I tried from cmd, following all the instructions and the advices from this forum, and @dolaf I didn’t understood at all what do you mean with environment variables PYTHONHOME and PYTHONPATH. May I have more clarifications on your last comment, please? (Keep in mind that I need very “naive” explanations, if it’s not a problem for you. I thank you very much in advance for your help)
On a Windows 10 platform, type Environment in the start menu and choose:
Then,
Then, remove this variable, and PYTHONPATH if they exist
These variables are sometimes automatically added by programs that like to use them. Many programs look for this variable and will use the python version it points to, but this creates a lot of problems on a Windows platform that has a lot of different Python installations.
EDIT: This is not the correct method. See later in the thread.
Ok, I have esa_snappy working with Python 3.10 Anaconda environment with Windows 10. There were three steps I was missing.
I needed to install jpy in my python environment with this command, pip install jpy
I needed to install a Java Development Kit, but not the newest one (22). I installed OpenJDK 11.
And I needed to create a SNAP_HOME environment variable that points to the install directory of Snap. On my machine it’s here,
It would be nice to have these steps mentioned in the docs for setting up esa_snappy to work with Snap 10. It’s great to have the functionality of Python working with Snap available!
good to hear you got it running. However, all these steps should no longer be necessary with esa_snappy in SNAP 10 (no manual jpy installation, no additional JDK etc). We spent quite a bit of time to get rid of all this from SNAP 10 onwards.
Therefore, a few comments which might help to solve also your original problem:
Your previous post: yes, the installation looks incomplete. After a successful installation, jpyutil.py should be in the esa_snappy folder:
I understand that your setup is Win10 and Python3.10 with a virtual env ‘esa_snappy_310’ in which you want to have esa_snappy installed in the corresponding site-packages folder (instead of the default folder .snap\snap-python).
I set up an equivalent Windows 10 test scenario on my side:
installed SNAP 10 from latest installer
installed Miniconda Python3.10
created a virtual environment: D:\olaf\miniconda3_py310\condabin> conda.bat create -n env_test_esa_snappy python=3.10
(note that the Python version must be specified, otherwise the latest version 3.12 would be installed, which is not (yet) supported by esa_snappy) D:\olaf\miniconda3_py310\condabin> conda.bat activate env_test_esa_snappy
run snappy-conf: (env_test_esa_snappy) D:\olaf\bc\snap-snapshots\10\10.0-release\snap\bin> snappy-conf.bat "D:\olaf\miniconda3_py310\envs\env_test_esa_snappy\python.exe" "D:\olaf\miniconda3_py310\envs\env_test_esa_snappy\Lib\site-packages"
test: (env_test_esa_snappy) D:\olaf> python
Python 3.10.14 | packaged by Anaconda, Inc. | (main, Mar 21 2024, 16:20:14) [MSC v.1916 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information. > import esa_snappy
→ works all fine
I’m not sure if this helps for you, as it seems that you basically tried the same. Are your ‘base’ Python and the ‘esa_snappy_310’ Python both 3.10 (although I don’t know if this makes a difference)? If nothing helps, I suggest that you reinstall everything following the steps as listed above. Also make sure that you clean relevant folders, such as the esa_snappy target, from (incomplete) content of previous unsuccessful tries.
Btw., thanks for posting the PYTHONPATH/PYTHONHOME explanations!
your log messages are incomplete, but do not show any errors. We noticed that sometimes the snappy-conf log messages are incomplete like this, or the command prompt does not come back, although the installation was successful in background. The reason for this behaviour needs to be investigated. The full set of log messages for a successful installation should look as shown below:
Therefore, could you please check if the folder [your homedir]\.snappy\snap-python\esa_snappy exists, and if you can import esa_snappy in your Python called with C\Users\niput\anaconda3\envs\snapenv\python.exe ?
@dolaf I followed all the steps reported. I ensured to remove PYTHONHOME and PYTHONPATH (they were not already inserted), and I ensured to have .snap/snap-python. Following all the steps you mention here
There must be something in my environment that (and others) that is throwing off the install. I cleaned out everything I can find. User Path, System PATH env variables, snap folders in Program Files, folders in User directory, removed past environments in conda and miniforge. etc…
I downloaded a new install file, this time ALL toolboxes rather than just sentinel. I get this window still, so there must be something it’s finding that I’m not aware of.
I checked the “Configure SNAP for use with Python” but left the Python executable path blank during installation. Different than I usually do.
I also left the “Extend my PATH environment variable” even though I usually uncheck it.
I tried a new installation of Anaconda with a new environment there as well. But my result stays the same,
I have two desktops that I have tried the same steps with and get the same results.
You’ve given me the confidence that this process should work, but there is a disconnect somewhere in the installation, and snappy-conf.bat fails, not due to Windows Environment Variables it seems.
@dolaf I found a way to make it work, but when I import esa_snappy I have the error “can’t find any JVM shared library”.
What does it mean? I already have installed JVM!
Hi, i solved this issue with the definition of JAVA_HOME env variable, if you don’t want to define a global one you can create one just for your conda environment. First activate your env and then run:
conda env config vars set JAVA_HOME="C:\Program Files\esa-snap\jre"
If C:\Program Files\esa-snap\ is not your snap installation path search for it and use your path to jre folder.
I downloaded a new install file, this time ALL toolboxes rather than just sentinel. I get this window still, so there must be something it’s finding that I’m not aware of
‘SNAP User Data’ window: if you select ‘Yes, try deleting all SNAP user data’, everything in your [home directory]\.snap folder will be deleted (usually not recommended). The default snap-python folder is part of this, but it should not make a difference for the esa_snappy configuration. If .snap\snap-python is not present, it will be generated.
I checked the “Configure SNAP for use with Python” but left the Python executable path blank during installation.
This does not make sense and cannot work. If you want to configure esa_snappy during the SNAP installation, you should specify an existing python.exe here.
I also left the “Extend my PATH environment variable” even though I usually uncheck it.
[SNAP installation dir]\bin is added to the path. Should not make a difference for esa_snappy either.
I have two desktops that I have tried the same steps with and get the same results.
I also tried the same procedure on a second Win10 machine. All working fine. I know that this does not help you, but it is very hard for us to find out as long as we cannot even reproduce your problem in our test environments. I would guess that it is somehow related to a failure inside jpy, which would explain the empty stack trace. You said before that you installed jpy manually (no longer needed with esa_snappy in SNAP 10), does that installation still exist?