Urgent problem with snappy and snap 6.0

I did not re-configure snappy, but I tried to read a S-3 product and a Meris product and it works, only S2 product is giving problems

and yes, snap desktop works fine

Please, could you try to run again snappy-conf and check if that fixes your problem?

ok, I am going to do it. Give me some minutes, and thanks for the help , I will tell you what happens

ok, I have tried to run again snappy conf and installed the setup.py on my anaconda environment as usual but this is still the output for an S-2 product :

import snappy
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
from snappy import ProductIO
a = ProductIO.readProduct(‘C:\Program Files\snap\S2B_MSIL1C_20170802T092029_N0205_R093_T34SDG_20170802T092856.SAFE\MTD_MSIL1C.xml’)
INFO: org.esa.s2tbx.dataio.s2.ortho.S2OrthoProductReaderPlugIn: Building product reader - EPSG:32634
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [metadata_level] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [granuleidentifier] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [bandid] does not exist
INFO: org.hsqldb.persist.Logger: dataFileCache open start
Traceback (most recent call last):
File “”, line 1, in
RuntimeError: java.lang.IncompatibleClassChangeError: Implementing class

for S-3 product no problem in reading

If you execute “pip list”, which is the version of snappy you are using?

Maybe there are old libraries from the SNAP 5 installation in the`%appdata%/SNAP folder.
Can you check this?

Sorry but yesterday I had to uninstall the 6.0 and go back to the 5.0 that works perfectly. Anyway for the S-2 products even the 5.0 version always gives (and was giving before going to 6.0) this to me:

WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [metadata_level] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [granuleidentifier] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [bandid] does not exist

but in the 5.0 the products are correctly read and I can work with them

Could that be the reason of the problems with 6.0?

I had to remove snap 6.0 because I am working with snap and I need a working version

Hello,

Just wanted to say this seems like a common problem. I had the same issue with same errors with snap 6.0 using snappy. Re-installed snap 5.0 and the issue is gone.

Dear all,

I’m facing the same issue when opening S2 products with snappy (SNAP 6). This happens regardless of loading a .zip or .xml file.

This is the code and error output (DEBUG is enabled):


from snappy import ProductIO
p = ProductIO.readProduct(‘S2A_MSIL1C_20170330T073611_N0204_R092_T37PFR_20170330T075431.zip’)

Exception in thread “main” java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties;
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDataSource.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDataSource.getConnection(Unknown Source)
at org.geotools.referencing.factory.epsg.DirectEpsgFactory.getConnection(DirectEpsgFactory.java:3302)
at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.createBackingStore(ThreadedEpsgFactory.java:436)
at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:133)
at org.geotools.referencing.factory.BufferedAuthorityFactory.isAvailable(BufferedAuthorityFactory.java:235)
at org.geotools.referencing.factory.DeferredAuthorityFactory.isAvailable(DeferredAuthorityFactory.java:119)
at org.geotools.factory.FactoryRegistry.isAvailable(FactoryRegistry.java:667)
at org.geotools.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:501)
at org.geotools.factory.FactoryRegistry$1.filter(FactoryRegistry.java:192)
at javax.imageio.spi.FilterIterator.advance(ServiceRegistry.java:821)
at javax.imageio.spi.FilterIterator.(ServiceRegistry.java:815)
at javax.imageio.spi.ServiceRegistry.getServiceProviders(ServiceRegistry.java:516)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:197)
at org.geotools.referencing.ReferencingFactoryFinder.getFactories(ReferencingFactoryFinder.java:180)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactories(ReferencingFactoryFinder.java:455)
at org.geotools.referencing.DefaultAuthorityFactory.getBackingFactory(DefaultAuthorityFactory.java:89)
at org.geotools.referencing.DefaultAuthorityFactory.(DefaultAuthorityFactory.java:69)
at org.geotools.referencing.CRS.getAuthorityFactory(CRS.java:263)
at org.geotools.referencing.CRS.decode(CRS.java:525)
at org.geotools.referencing.CRS.decode(CRS.java:453)
at org.esa.s2tbx.dataio.s2.ortho.Sentinel2OrthoProductReader.getMosaicProduct(Sentinel2OrthoProductReader.java:213)
at org.esa.s2tbx.dataio.s2.Sentinel2ProductReader.readProductNodesImpl(Sentinel2ProductReader.java:168)
at org.esa.snap.core.dataio.AbstractProductReader.readProductNodes(AbstractProductReader.java:169)
at org.esa.s2tbx.dataio.s2.ortho.Sentinel2OrthoProductReaderProxy.readProductNodes(Sentinel2OrthoProductReaderProxy.java:85)
at org.esa.snap.core.dataio.ProductIO.readProductImpl(ProductIO.java:216)
at org.esa.snap.core.dataio.ProductIO.readProduct(ProductIO.java:186)

RuntimeError: java.lang.NoSuchMethodError: org.hsqldb.DatabaseURL.parseURL(Ljava/lang/String;ZZ)Lorg/hsqldb/persist/HsqlProperties;


The error seems related to “hsqldb” libraries or related drivers.

I have another machine running the same script (also with SNAP.6), and surprisingly it succeeds in opening the file. I’ve noticed that on this machine, the loaded hsqldb.jar is different. This is the debug output when importing ProductIO:

/usr/local/lib/python2.7/dist-packages/snappy: env =
‘hsqldb.jar’: ‘/home/seb/snap/snap/modules/ext/org.esa.snap.snap-core/org-hsqldb/hsqldb.jar’

On the machine that doesn’t work, the file is:
/usr/local/lib/python2.7/dist-packages/snappy: env =
‘hsqldb.jar’: ‘/home/sebastien/snap/snap/modules/ext/org.esa.snap.snap-core/hsqldb/hsqldb.jar’

Could this be the issue? Or is a driver missing on the machine, which should be installed separately from snap?

Many thanks for your help!
Sebastien

EDIT: the same errors related to “hsqldb” appeared when processing S1 (although reading the products did work).

SOLVED: uninstalling SNAP and reinstalling SNAP 6.0 has solved everything: I’m now able to open/process S1 and S2 products with snappy 6.0.

This had been already suggested in another post (Issues reading images with snappy), however in my case these steps hadn’t worked. I’ve done a more “thorough” uninstallation, and this time it worked… In case other user face the same problems, here is what I did:

cd ~/snap/bin
. uninstall
sudo pip uninstall snappy #this only downgrades snappy (see pip list)
sudo rm -r /usr/local/lib/python2.7/dist-packages/snappy/
sudo rm -rf .snap/
sudo reboot now

Hope that helps!

1 Like

I just got the same error as the OP after upgrading to SNAP 6. Is there a fix? I just deleted the .snap folder in my user directory and %APPDATA%/Roaming/SNAP. Than I reconfigured snappy by running snappy-conf from the SNAP Command-Line.

I still get the IncompatibleClassChangeError when running getTargetProduct() or createProduct([...]) but not when I call readProduct([...]). I’m working with TSX data.

Here are the error messages:

  • for SubsetOp() and then .getTargetProduct(): RuntimeError: java.lang.IncompatibleClassChangeError: Implementing class
  • and for snappy.GPF.createProduct() (I tried this with Calibration and Speckle-Filter): java.lang.IncompatibleClassChangeError: org/ejml/data/FixedMatrix3x3_64F

I also tried to run the testfiles in the snappy directory. Unlike when I tested my own code, these already fail when calling readProduct. In each of the three test files, every test fails upon encountering readProduct in the setUp method.
(I changed test_product_file to the .dim file provided in the testfiles folder.)
The first test that is run in a concole always leads to the error:

Traceback (most recent call last):
File “C:/Users/lukassch.stu/.snap/snap-python/snappy/tests/test_snappy_perf.py”, line 18, in setUp
self.product = snappy.ProductIO.readProduct(test_product_file)
RuntimeError: java.lang.IncompatibleClassChangeError: Implementing class

while all subsequent tests yield:

Traceback (most recent call last):
File “C:/Users//.snap/snap-python/snappy/tests/test_snappy_product.py”, line 18, in setUp
self.product = snappy.ProductIO.readProduct(test_product_file)
RuntimeError: java.lang.IncompatibleClassChangeError: org/ejml/data/FixedMatrix3x3_64F

Here’s the console output when running snappy\tests\test_snappy_product.py with Debug: True set in snappy.ini

IncompatibleClassChangeError_log.txt (42.7 KB)

I think the key lines are:

 ['C:\\Program Files\\snap\\snap\\modules\\lib\\amd64',
  'C:\\Program Files\\snap\\snap\\modules\\lib'])
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readValidMask": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True
annotate_RasterDataNode_methods: Method "readPixels": modified parameter 4: mutable = True, return = True

Looks like a version issue between two components of the framework as per Stackoverflow. But what do I have to reinstall to make all the versions compatible? snappy, jpy, Java, SNAP? So far I’ve reconfigured snappy and my understanding is that jpy is only inside snappy (couldn’t find it anywhere else on my computer), so jpy shouldn’t be the culprit. What versions of these do I need? And how do I even figure out the versions of my snappy and jpy?

Any other option besides reverting to SNAP 5?

In any case, reinstalling SNAP 6.0, as seb suggested, solved it for me.

I did the following:

  1. Uninstall SNAP 6.0, following the prompts.
  2. Delete %USERPROFILE%\.snap
  3. Delete %APPDATA%\SNAP
  4. Reboot
  5. Install SNAP 6.0, following the prompts. I selected to delete all user data (probably not required but who knows) and to install Python.
  6. Copy %USERPROFILE%\.snap\snap-python\snappy to the \Lib\site-packages folder in Anaconda2.

I have a similar problem but only for Sentinel 2 - level 2A products. The log of my script looks like the following:

INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.s2tbx.dataio.s2.ortho.S2OrthoProductReaderPlugIn: Building product reader - EPSG:32635
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [product_format] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [datatake_sensing_start] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [spacecraft_name] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [datatake_sensing_start] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [product_start_time] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [product_stop_time] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [processing_level] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [metadata_level] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [l2a_boa_quantification_value] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [l2a_aot_quantification_value] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [l2a_wvp_quantification_value] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [product_format] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [granuleidentifier] does not exist
WARNING: org.esa.s2tbx.dataio.metadata.GenericXmlMetadata: Metadata: the path to element [granuleidentifier] does not exist
Traceback (most recent call last):
File “create_ndvi.py”, line 7, in
product = ProductIO.readProduct(file_path)
RuntimeError: java.io.IOException: No valid tiles associated to product [MTD_MSIL2A.xml]

For level 1C it works, but for level 2A no. What can it be ? I installed SNAP 6.0 this days and I’m using an Anaconda py34 environment.
I will apreciate any opinion!

If I run in cmd it seems to work. What can be the issue ? I would like to work in Anaconda env.

Have you updated SNAP ( Menu-> Tools -> Plugins -> Updates)? The L2A format has changed and it is required at least the version 6.0.1 of S2 Toolbox to be able to read it.

Yes, SNAP is fully updated.

What is interesting is that if I’m calling the script to run from the snappy folder (in anaconda on c:\users…snappy\snappy-python) the script is running ok. Inside the script I must use also the import sys to append each time the path to snappy library.

Here are the steps that I used to install SNAP.
Downloaded the 64bit version of full SNAP -> Installed on win 10 pro 64bit with python snappy option enabled + I give the path to the python 3.4 from one of my secondary anaconda environments py34 (I don’t have python 3.4 as main python version installed on my pc, my main python is Anaconda 3 (64bit) with python 3.6, python 3.4 is installed as a secondary environment py34).

I’m planning to setup a nice developing environment in anaconda 3 but I just can’t figure it out what may be the issue.
I would like to run the script from the script folder or any other position on disk.
What I’m doing wrong?

Please feel free to criticize :slight_smile: or to give me any advice that can help.

You say you are importing snappy via sys.path.append
Have you tried the other options in the Configure Python section?
https://senbox.atlassian.net/wiki/spaces/SNAP/pages/50855941/Configure+Python+to+use+the+SNAP-Python+snappy+interface

As Omar already said, the error sounds really like if you have an older version of the S2-Toolbox.
Maybe you have two instances of SNAP installed? One update and the other not`?

I’ll make a try and reinstall SNAP and snappy. Do you have any advice on how to find and remove all libraries and files connected to SNAP and snappy? Is uninstall enough to remove everything ?

After reinstalling, the snappy module can be imported, and the script is running ok, only when I am on any path on C:, it doesn’t work when I try to run the script from the project folder on D:\

(py34) C:\Users\The Specialist>python
Python 3.4.5 |Anaconda 4.3.1 (64-bit)| (default, Jul 5 2016, 14:53:07) [MSC v.1600 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

import snappy
INFO: org.esa.snap.python.gpf.PyOperatorSpi: Python operator ‘S2RutOp’ registered (Python module: ‘s2_rut’, class: ‘S2RutOp’, root: ‘C:\Users\The Specialist\AppData\Roaming\SNAP\modules\org-esa-snap-snap-rut.jar’)
INFO: org.esa.snap.python.gpf.PyOperatorSpi: Python operator ‘py_sambuca_snap_op’ registered (Python module: ‘sambuca_snap_op’, class: ‘sambuca_snap_op’, root: ‘C:\Users\The Specialist\AppData\Roaming\SNAP\modules\org-esa-sen2coral-sen2coral-inversion.jar’)
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters

quit()

(py34) C:\Users\The Specialist>d:

(py34) D:>python
Python 3.4.5 |Anaconda 4.3.1 (64-bit)| (default, Jul 5 2016, 14:53:07) [MSC v.1600 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

import snappy
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters

The output in the last situation is different than previous, the snappy module doesn’t load properly and in this situation the script is not working and it ends with RuntimeError: java.io.IOException: No valid tiles associated to product [MTD_MSIL2A.xml].