Configuring Snappy On Centos

Hi there,

I’m setting up a vagrant box with snappy installed.

When I run

sudo ./snappy-conf $(which python)

I get

INFO: Installing from Java module '/home/sar/snap/snap/modules/org-esa-snap-snap-python.jar'
WARNING: Architecture requirement possibly not met: Python is x86_64 but JVM requires amd64
INFO: Installing jpy...
INFO: Extracting 'lib/jpy-0.8.0-cp27-none-linux_x86_64.whl' from '/home/sar/snap/snap/modules/org-esa-snap-snap-python.jar'
INFO: Unzipping '/usr/lib64/python2.7/site-packages/snappy/lib/jpy-0.8.0-cp27-none-linux_x86_64.whl'
INFO: Configuring jpy...
INFO: jpy Python API configuration written to '/usr/lib64/python2.7/site-packages/snappy/jpyconfig.py'
INFO: jpy Java API configuration written to '/usr/lib64/python2.7/site-packages/snappy/jpyconfig.properties'
INFO: Configuring snappy...
INFO: snappy configuration written to '/usr/lib64/python2.7/site-packages/snappy/snappy.ini'
INFO: Importing snappy for final test...
ERROR: Configuration failed
Traceback (most recent call last):
  File "./snappyutil.py", line 266, in _main
    force=args.force)
  File "./snappyutil.py", line 213, in _configure_snappy
    __import__('snappy')
  File "/usr/lib64/python2.7/site-packages/snappy/../snappy/__init__.py", line 235, in <module>
    jpy.create_jvm(options=_get_snap_jvm_options())
RuntimeError: jpy: failed to create Java VM

When I cat the log file.

Any ideas?

As it is installed properly and only the final test fails, I guess there is something odd with VM. Maybe not enough memory, or something.

Could you enable the debug option?
Go to your snappy directory and modify the snappy.ini file. I guess it exists already even the installation failed, add the following line

debug: True

If you now use snappy you should see more error messages when the VM is started.
In addition you could also edit the __init__.py file.
In line 75 add diagnosis flag for the JVM.

jpy.diag.flags = jpy.diag.F_EXEC + jpy.diag.F_ERR + jpy.diag.F_JVM

Maybe this helps.

1 Like

Doh.

Should have thought about the memory!

Forgot my VM didn’t even have 4GB, works now! However now when I do import snappy in python I get:

Python 2.7.5 (default, Aug  4 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import snappy
SEVERE: org.esa.s2tbx.dataio.gdal.activator.GDALDistributionInstaller: The environment variable LD_LIBRARY_PATH is not set. It must contain the current folder '.'.
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters

These messages are okay. At least as long you don’t want to use GDAL.

Right, any quick fix if I do want to?

Not that I do right now, I’m doing SAR processing so only using S1TBX and maybe some raster subsetting but I’m sure for other people a fix might be useful?

Many thanks!

Sorry, but I don’t know the status of the GDAL integration. In the SNAP Help it is said, that it is only available on Windows, but I think this is outdated.
Maybe @kraftek or @ramona_manda can say something about it?

Hello,
GDAL integration is available in S2TBX, for win32/64 and linux, by having the following readers: BT, ERMapper, GS7BG, GSBG, GTX, HFA, ILWIS, KRO, MFF, NITF, PCIDSK, RMF, RST, SAGA, SGI and the following writers: BMP, BT, GS7BG, GSBG, GTiff, GTX, HFA, ILWIS, KRO, MFF, NITF, PCIDSK, PNM, RMF, RST, SAGA, SGI. This information is also available in the help of SNAP. I will investigate the ‘LD_LIBRARY_PATH’ severe error and let you know if it can be fixed.

@ramona_manda Sorry I’m bumping this, but I am interested on GDAL integration. I am understanding this can’t be fixed yet or maybe you (understandably) forgot about the issue? Thanks for any insights.