Snappy configuration error: python 2.7

Hello

I have recently installed SNAP in my windows 10. During the installation, I configured python.exe. It is, however, not configured properly.I have the error log. Isnappyutil.log (796 Bytes)
I have thoroughly gone through another similar post but could not find a solution.

I am using python 2.7 with spyder.

Do you have the Windows 32-bit SNAP? From the log it looks like you have a 32-bit python 2.7:

INFO: Extracting 'lib/jpy-0.9.0-cp27-cp27m-win32.whl' from 'D:\snap\snap\modules\org-esa-snap-snap-python.jar'
INFO: Unzipping 'C:\Users\Administrator\.snap\snap-python\snappy\lib\jpy-0.9.0-cp27-cp27m-win32.whl'

The instructions should probably mention that you need to use a 64-bit Python with a 64-bit SNAP.

ArcGIS users often encounter this problem. If you do need keep your 32-bit Python it can be a bit tricky to ensure that different applications use the matching Python version. If you do need to install a 64-bit Python for snappy I recommend the most recent supported Python (3.6). You will end up with two python.exe programs. I like to install them in C:\PythonXY directories.

If you append <snappy-dir> to the sys.path variable in your Python code before importing snappy, along the lines of the template using USERPROFILE to locate the
snappy module you can use .cmd files to provide the path to the Python version you want to use with snappy. For each Python script that uses snappy you can either use a one-line snappy.cmd file:

C:\Python36\python %*

or make a file <script_name>.cmd:

C:\Python36\python <path_to_script>/<script_name.py> %*
pause

(the pause is needed if you run the script by clicking on it so the terminal window doesn’t close before you get a chance to see any output).

1 Like

I am not sure what it means to have two versions of python. I used arcGIS in my system about two years ago. Since I don’t use arcGIS anymore I can delete the other version of python. Can you tell me how to do it? I am not able to find other version of pyhton except the one that I just reinstalled (python 3.7, 64-bit); my snap version is also 64-bit.

Python 3.7 is too new to work with snappy. Your log indicates that snappy-conf found a 32-bit python 2.7, so I’m guessing that the failure was because you installed 64-bit SNAP. Windows often has multiple python programs. GIS packages other than ArcGIS (QGIS) install Python. Window 10 search isn’t good at finding “python.exe”, so it can be hard to detect unwanted versions. You can try running pythonX --version in a terminal to see what snappy-conf would find if you don’t specify something like `C:\PythonNN\python.exe. Here I get:

C:\>echo (none) & python --version & echo 2 & python2 --version & echo 3 & python3 --version
(none)
[blank]
2
Python 2.7.17
3
[blank]

(In Windows 10 if you just enter python in a terminal the App Store offers version 3.7).

Your best bet is to get the Python Foundation’s Python 3.6.8 someplace like C:\Python36 and always use C:\Python36\python.exe with snappy-conf and for snappy scripts.

2 Likes

It worked.
Thank you gnwiii.
I removed pyhton2.7 and pyhton 3.7 and installed the one you suggested.