I have now spent several hours to start snappy in Anaconda.
I have put snappy package directory into the Anaconda python package directory
I have configured snappy.ini
Notice that the doc to install snappy is not up-to-date you need a header section which I assumed was called snap. So it looks like this
But I get this error
In : import snappy
IOError Traceback (most recent call last)
----> 1 import snappy
/home/julien/anaconda2/lib/python2.7/site-packages/snappy/__init__.py in <module>()
233 called_from_java = jpy.has_jvm()
234 if not called_from_java:
--> 235 jpy.create_jvm(options=_get_snap_jvm_options())
/home/julien/anaconda2/lib/python2.7/site-packages/snappy/__init__.py in _get_snap_jvm_options()
199 raise IOError("Can't find SNAP distribution directory. Either configure variable 'snap_home' " +
200 "in file './snappy.ini' or set environment variable 'SNAP_HOME' to an " +
--> 201 "existing SNAP distribution directory.")
203 env = _get_snap_jvm_env()
IOError: Can't find SNAP distribution directory. Either configure variable 'snap_home' in file './snappy.ini' or set environment variable 'SNAP_HOME' to an existing SNAP distribution directory.
I am suspecting there are mutliple issues but I can’t get my head around it.
Of course /home/julien/.snap is the right directory
I would like to resinstall the snappy module but I don’t know where to start to make it clean
Thanks in advance
snap_home should be set to the fullpath of the main SNAP directory, not the
.snap user settings directory.
More information would be helpful.
You shouldn’t need anaconda python for snappy on Ubuntu 16.04. Did you install anaconda after
having problems with the distro python2.7? Which version of SNAP do you have? Did you specify the path to anaconda python when you installed SNAP? This path is passed by the installer to
snappy-conf, but you can also run
snappy-conf in a terminal:
Configures the SNAP-Python interface 'snappy'.
usage: snappy-conf <python> [<dir>]
<python> Full path to Python executable to be used with SNAP, e.g. /user/bin/python3
<dir> Directory where the 'snappy' module should be installed. Defaults to ~/.snap/snap-python
This does more than just creating
snappy.ini, it also tries to find the jpy binary version that goes with
your python version. The details are recorded in the log file. There have been problems with updates
that didn’t install changes to the snappy scripts. If
snappy-conf fails, you can search STEP forum for
the error you get.
OK that clarifies stuff thanks a million
I did install Anaconda because it was originally recommended. I only used it to run SNAP and sen2cor. If you tell me it is of no use I will happily wipe it off my drive.
I am using SNAP5.0
I ran snappy-conf several time and I had the persistent error similar to this post
with a Java max memory undefined error
I have tried to write to the snappy.ini
snap_home = /usr/local/bin/snap
But it would not work, python tells me that this is not a valid path. And of course running snappy-conf wipe snappy.ini
I have tried to export the environment variable before running python and it would not work either.
So I decided to give a go to SNAP 6 since it seems released officially now.
Hopefully I get more success
/usr/local/bin/snap is probably not what you want. In most cases, you should install SNAP as a normal user. The default is a top-level directory
$HOME/snap that contains
Many people prefer to install 3rd party software under
/opt/<vendor>, so you could use something like
sudo to create the ESA directory and then change ownership to the regular user account that will be used for the install. If you stick with the default and have
/home/<user>/snap/bin/snappy-conf, the installer should set
snap_home = /home/<user>/snap. You can try the distro python2.7 (enter
/usr/bin/python2.7 in the installer).
You are right, I could not remember why I did the installation in the local/bin. It was an error.
I started from scratch with SNAP 6 and removed all the different tries.
There was a glitch because there is a google compression script called snappy.py and I had it in my dist-packages…
After renaming and changing the PATH to
I could import snappy but with error messages.
Notice that in the snappyutillog it is written that you should export the following environment variable which does not work (needs to be up one level)
The error import message in the bash is
SEVERE: org.esa.s2tbx.dataio.gdal.activator.GDALDistributionInstaller: The environment variable LD_LIBRARY_PATH does not contain the current folder ‘.’. Its value is ‘/usr/local/Madagascar_1.5/lib’
Would you tell me which folder I should put for the LD_LIBRARY_PATH ?
Thanks a lot!
Having LD_LIBRARY_PATH set globally is a security risk, as a malicious intruder might be able to put fake versions of system libraries in that directory. If you only need
LD_LIBRARY_PATH for one application there are ways to set it only when needed. Issues reading images with snappy discusses this message.
For SNAP 6.0 it seems to have changed from SEVERE to INFO.
I had big trouble to find out where the environmental variable was coming from. It happened that a script associated with the library of Madagascar was the culprit. Thanks for informing me about it.