Openjp2 is not be loaded

Hi,

could you get print screen of this problem?

Regards

Best.

And I got this error when converting

On other topic a person with nick chris said:

heres what worked for me:
I replaced
\Anaconda\Scripts\openjp2.dll with the openjp2.dll from the previous
2.0.4 sen2cor realease in the software archive, see:http://s2tbx.telespazio-vega.de/sen2cor/archive/sen2cor-2.0.4/12

Download the zip-archive and unpack it.
Go to the directory sen2cor-2.0.4\sen2cor\build\lib.win-amd64-2.7 which contains an openjp2.dll.
Replace the original openjp2.dll in your Anaconda Installation ( \Anaconda\Scripts) with this one.

I am not sure, if this is the correct way to solve the problem!

Regards

2 Likes

Thank you so much.

It worked.

This is a test, only if you observe the following problem when trying to run sen2cor on windows:

C:\Anaconda\lib\site-packages\Glymur-0.8.0-py2.7.egg\glymur\lib\config.py:102:
UserWarning: The library specified by configuration file at C:\Anaconda\Scripts\openjp2.dll could not be loaded.

  1. download this folder:

http://s2tbx.telespazio-vega.de/sen2cor/testopenjp2_win-amd64

into a directory of your choice

  1. open the command line prompt and execute ‘test.bat’.

Please do not execute testopenjp2.exe directly. It might load your old corrupt openjp2.dll instead, as it is
found via the PATH environment variable. Test.bat will temporarily modify the path in order to load the new dll.

If you then receive the following message (or similar):
openjp2.dll = <PyInstallerWinDLL ‘openjp2.dll’, handle 68ac0000 at 1eed160>
The library could be loaded.

you can take the file ‘openjp2.dll’ from this directory
and replace the file with the same name, located in the Anaconda\Scripts directory:

C:\Users\XYZ\Anaconda\Scripts

After this modification, the processor should run.
The new processor, which will be released within the next days will have the new dll by default.

However, if you still receive an error message like:
openjp2.dll = None
The library could NOT be loaded.
Then please post this result in the forum, as then our theory would be wrong.

most probable reason for the problem observed by a couple of users as we currently can identify:

The openjpeg DLL shipped with the previous versions of sen2cor was compiled with VC++.
The DLL needs msvcr120.dll and msvcp120.dll to load properly.
These two libraries are in most cases part of the windows installation under Windows\System32,
but in some cases, they are apparently not present.

The new library is build with mingw, and has no longer any dependency to the VC++ runtime dll.

1 Like

the link you put to download the test folder is not valid now ,could you please update it? thanks

It has been removed with the release of sen2cor 2.2.1. The whole sen2cor project has been moved to the official site which is: http://step.esa.int/main/third-party-plugins-2/sen2cor

The problem persists with sen2cor 2.2.1, which is why bwbj was asking most likely.
I am running it on CentOS.

but then it’s a complete different problem. The test was only related to windows. If you have problems with CentOS, then perform the following checks:

  1. in your users directory - does the hidden directory .config exists? It is normally created during the sen2cor installation (inf not already present).
  2. in .config, does a directory called glymur exist?
  3. if yes, step to this directory and type ‘cat glymurrc’. You will find a path pointing to the openjpeg library
  4. check whether the openjpeg library is located at the position where the path points to. The library itself is called libopenjp2.so. If everything is OK, then check with ‘file libopenjp2.so’ which type of library it is.

Tell me your results, after performaing these steps.

You are right, glymurrc’s path was not pointing to the right location. Thanks for the assistance!

The type of library is the following: “ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped”, if it may help others.

I’m wondering why it did not point to the right direction. Did you install sen2cor under a different account? e.g. as a supervisor?

thanks for your kindly reply although I cannot fix it yet.
I post a new topic here and looking forward to your attentions

Hi unwill,
And what if it isn’t the .config folder?
I have the same problem with the openJPEG. I chandged the .dll for the 2.2.1 version as said in the forum.
Sen2cor 2.3.0 starts correctly and creates ther folder structure S2A_USER_PRD_MSIL2A_… but stops at the first seconds:
with this message “raise OpenJPEGLibraryError(“OpenJPEG function failure.”)
OpenJPEGLibraryError: OpenJPEG function failure.”

in command line, it says the same:
File “C:\Users\cpadro\AppData\Local\Continuum\Anaconda2\lib\site-packages\glym
ur\lib\openjp2.py”, line 600, in check_error
raise OpenJPEGLibraryError(“OpenJPEG function failure.”)

I’ve gone to C:\Users\cpadro\AppData\Local\Continuum\Anaconda2\lib\site-packages\glym
ur\ but there is no ‘cat glymurrc’ there.
OpenJPEGLibraryError: OpenJPEG function failure.

Thank you very much.

On windows it is different. There is no .config folder. Glymurr checks a series of locations for the openjp2.dll. Sen2Cor is equipped with an openjp2.dll which is compatible with the recent glymur package and should normally run out of the box. If this fails (as it seems the case on your site), you can try to perform a fresh new OpenJPEG installation via conda as is decribed under:

https://anaconda.org/IOOS/openjpeg

You should then remove the openjp2.dll located in the anaconda script directory so that the new dll is loaded instead (search for openjp2.dll in the anaconda directory to find it).

If you then still receive the error on an OpenJPEG function failure, the most probable reason might be, that an older (incompatible) version of the openjpeg2 dll is already installed and might be located in a path on your system, which has a priority and is loaded instead the correct one. Can you have a check, whether an old version of the openjp2.dll probably might be located in your Windows System folders?

Hello Mr. Umwilm,

after a week trying to solve tho problem with the openjp2 library, I have not succeed:
I searched for openjp2 libraries in the windows system and there wasn’t.
I uninstalled everything (sen2cor, SNAP, anaconda,…) and installed everything brand new (conda [2.7] last version, SNAP 5.0, sen2cor 2.3.0).

Right now I have updated with the openjp2 library and the module is out of work. Is there anything special to do when unpdating (apart to restart SNAP)? Does it works you?

King regards.
Cristian.

I’ve upload the sen2cor openjp2 library (5.0.1) and even it says it is well installed, it doesn’t works when I call it from SNAP. Moreover, SNAP doesn’t detects sen2cor as an external tool to manage. Any recomendation?

Thanks!!

Regarding the tool within SNAP.
Probably it helps if you remove the ‘java’ entry from snap.clusters file. This file is located in <installation_dir>\etc. This file is normally not editable. You have to give your self write permission before you edit it.
Maybe you need to uninstall the plugin and reinstall it afterwards.
A general fix is on the way.

Thank you very much, Marco.
So on, apart of trying to remove the ‘java’ entry of snap.cluster, the
better I wait for a fixed version of the openjp2 library, isn’t it?
Thanks for the support!

For the fix I was referring to the ‘java’ entry issue. Regarding the openjp2 library I don’t know the status.