Problem with Snappy and error

can you try and import snappy while you are within snappy folder?

Thanks a lot, I think it works now, I copied the snappy folder to the site-packages in python,

Thanks a lot, I think it works now

wow, i cannot believe it.
well done, you did it
you can work with snappy now :wink:

1 Like

Tremendous thanks to you and to @ABraun for your big efforts

1 Like

great to hear!

Normally, I mark one post as the solution so others can spot it more quickly, but to be honest, I don’t know what was the solution in the end. Probably a mix of interfering python instances (sen2cor) and and missing folders or path variables.

Thank you @johngan for your patience and congratulations @falahfakhri for keeping at it!

2 Likes

I think, one thing that is worth mentioning for all window users is not to mix up different python instance. I think that was the solution at the end.
Users need to have one clean python installation and make sure they use this path to configure snappy.

1 Like

I’m sorry I wasn’t paying attention when this thread started. Some of the confusion came from differences between Windows and linux/macOS. Many linux distros and software packages are migrating to Python 3, so users who have been running snappy in conjunction with 3rd party Python tools may need to reconfigure snappy for Python 3 in the next few years.

A few remarks that might help in the future:

  1. Getting python

Snappy currently supports Python versions 2.7 and 3.4.
Most linux distributions and macOS provide Python 2.7 and use Python 2.7 scripts for various system management tasks. These should work with snappy. Windows does not provide Python, but many packages such as OSGeo4W and ArcGIS include Python 2.7. Python 2 is being phased out, so new versions of linux and macOS may not include it. At present, many packages are in a transitional state and may use both Python 2 and Python 3. Most systems that provide Python 3 are using versions beyond 3.4.

  1. Where is python?

Windows cmd.exe provides “where.exe”:

C:\>where where
C:\Windows\System32\where.exe
C:\>where python
C:\OSGeo4W64\bin\python.exe 

On linux and MacOS, use type:

$ type type
type is a shell builtin
$ type python
python is /usr/bin/python
$ type python2
python2 is /usr/bin/python2
$ type python3
python3 is /usr/bin/python3

If you have multiple Python programs installed, the PATH variable controls which one is used. If you run Python by providing the full
path, you can control the version. Some Windows packages provide versions of the terminal that customize the PATH so the desired Python is used. These terminals often set other variables used by Python. If you plan to use snappy with other Python tools you may want to use the same Python program for both.

  1. Formatting paths:

Linux and macOS use forward slashes (/). Many Windows programs allow either / or \. When entering a path in Python you are using a Python string. Python (and many other languages) treat a backslash as a special character, and use \\ to insert a \ in a string variable.

3 Likes

this is a very useful hint because it helps to understand which python is called and where the (sometimes lost) packages are installed.

Any idea, why I got this error while trying up to install numpy, My python is 3.4 every things went fine about conf-sanppy

when I had tis problem I manually downloaded the whl file of the corresponding package (watch out for the correct python verseion) and installed it like this

pip install file.whl

I got the same error, I copied this file “scikit_nano-0.3.9-py34-none-any.whl” to python folder and then

pip install scikit_nano-0.3.9-py34-none-any.whl

It’s downloaded from https://www.lfd.uci.edu/~gohlke/pythonlibs/

that means the pip you are calling belongs to another Python instance.

Please try this
C:\Python34\Scripts\pip.exe install numpy

To go sure that it is really the correct one.

It would be interesting where the problem comes from. Please also try
where pip
to see a list of all directories with pip installed. One of them is probably the python installation which also caused the snappy error.

same error,

image

the numpy version of the whl you downloaded is not compatible with python 3.4.
Please try this one:
https://pypi.anaconda.org/carlkl/simple/numpy/1.11.0.dev0+unknown/numpy-1.11.0.dev0+unknown-cp34-none-win_amd64.whl
Source: https://pypi.anaconda.org/carlkl/simple/numpy/

1 Like

Windows os

It’s worth mentioning that I tried all python versions, and the only one could be conf. with snappy is 2.7 and 3.4

this an attempt of 3.5. As well as using miniconda and creates env, also doesn’t help at all, I hope this could be solved as I read suggestion today in here source of the post the page of conf. snappy should be updated.

With python 3.5 and create env py3.5 under miniconda/ it’s tried to confi but later one I received the same error,

As you see the older python versions have problems of packages,

I’ll comeback to previous solution of 3.4

no problem to use python 3.4 but the packages must match (at least this is what the error message is reporting). This is why I suggested to use another whl file to install numpy.

Another problem seems to be that there is a space in your path between FALAH and FAKHRI. I recommend to install all python distributions direclty under C:\PythonXY (XY denotes the version).

Thanks a lot, yes the whl file was not the correct one, now and yours is the one successfully installed

finally I found the compatible wheel from here https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.5.1/

for python34
and successfully installed matplotlib using the following way,

$ C:/Python34/Scripts/pip install matplotlib.whl

1 Like

in these days of multiple python versions it can be tricky to keep track
of the python version. Many linux distros have python2 (usually python 2.7) and python3 so you can use either version in the same
terminal session.

Windows configurations often set PYTHONHOME for a particular python version, so you get something like:

C:\Users\test>python3 --version
Python 3.7.0
C:\Users\test> python3 -c "import matplotlib"
Fatal Python error: initfsencoding: unable to load the file system codec
  File "C:\OSGeo4W64\apps\Python27\lib\encodings\__init__.py", line 123
    raise CodecRegistryError,\
                        ^
SyntaxError: invalid syntax

Current thread 0x00001504 (most recent call first):

This can be tricky to sort out as there are so many windows packages that install some python version.

Assuming you have a <your_python> running properly, a safe way to run pip () is <your_python> -m pip .... This ensures that the pip version matches the desired python version.

1 Like