Sen2Cor does not start to process (and does not return any errors)

Hello people,

I have a problem regarding the sen2cor Plugin. I can not get it to work correctly. If I try to process a L1C Sentinel-2 Product with Sen2Cor I am left with a black console window where nothing happens and an instantly disappearing progress bar. That’s it. No error message.

I would like to explain to you the way I installed it, because the installation itself already caused some trouble and maybe there is a hint why it is not working at all.

At first I downloaded and installed SNAP from there:
http://step.esa.int/main/download/

With all its tool boxes. I am using SNAP 3.0 64Bit on a Win7 64Bit machine. I also tried it on a Win10 64Bit machine but the overall problem occurs there as well.

Then I followed the Sen2Cor Setup Manual exactly:
I downloaded Sen2Cor and the Manual from here:
http://s2tbx.telespazio-vega.de/sen2cor/

  • I downloaded Anaconda Python 2.7 64Bit and installed it. Successfully
  • I downloaded sen2cor-2.0.6.zip, extracted it and installed it with: “python setup.py install”. It worked

According to the manual if “L2A_Process --help” does not return an error the installation was successful. Unfortunately it returend an Error:"ValueError: numpy.dtype has the wrong size, try recompiling"

After some research on Google and on this forum I noticed that Sen2Cor downgraded Anaconda’s numpy. So I upgraded it manually:

pip install --upgrade numpy
pip install --upgrade tables

I tried L2A_Process --help again…it worked!
So I opened up SNAP and went: Tools -> Plugins -> Available Plugins -> Sen2Cor -> Install. After installing Sen2Cor and restarting SNAP I loaded a Sentinel-2 Product an tried to process it. The Sen2Cor properties Window opened. Apperently Sen2Cor requires 3 System variables: SEN2COR_HOME, SEN2COR-BIN and PYTHON_BIN. PYTHON_BIN did not have a path…Again I did a little research on this Forum and found out that I can create a Windows environment variable in the control panel.
I did it with the path to the python.exe of the Anaconda Environment. After restarting SNAP it PYTHON_BIN now had a path.

So again I tried to process my Sentinel-2 Scene. Nothing happens. The progress bar pops up: Starting Tool Execution 0%…then it disappears and I am left with a black console Window where nothing happens:

According to the Taskmanager the CPU does not do anything.
I researched this Forum a lot but nothing suits my problem.
I tried reinstalling everything, I tried a different machine, I tried a different Snap Version (2.0), I tried choosing different Resolutions (10,20,60), I tried to process it without SNAP (via Command prompt) and I tried everything withouth upgrading numpy manually. I am left clueless.

If you noticed anything wrong with my installation description or have any clue on what I could try to make it work I would appreciate it.

Best Regards
Omnishambles

2 Likes

You seem to have done everything right with the installation. There are two parts here, the SEN2COR tool itself and the integration in SNAP.

About the integration in SNAP, the “blank console screen” and the empty PYTHON_BIN variable were bugs in SNAP that should be fixed by the latest module update. They should not prevent launching the tool anyway.

You said you launched the SEN2COR by itself on a command line prompt, what was the output?

Hey Nicolas,
thanks for replying.

About the integration in SNAP: I tried updating everything to the latest version (via Plugins -> Updates) but it does not change anything.
I tried it with SNAP 3.0 and SNAP 2.0 and with installing Sen2Cor first and without installing it first.
It still does nothing but I noticed, that a new Folder “S2A_USER_PRD_MSIL2A_PDMC…” has been created now. Unfortunately the Folder is empty.

About the sen2Cor command prompt: I am not quite sure what the input has to be. I tried the main Folder, like you see on the Screenshot.

If I try to use a .jp2 as input it says, that the file does not exist.
I am not very familiar with the command prompt, maybe you could tell me what your input line would be. I will try it then.

Best regards
Omnishambles

1 Like

Hi Omnishambles,
I’ve got the same problem. It worked the first time I run the tool in Snap but now I get the black window that does nothing.

Hello Omnishambles,

I noticed you’re still running the previous version (2.0.6) of sen2cor, which struggles with too long path names in Windows. Your path looks quite long to me, so try moving the product closer to the root (maybe C:\ ) and start it again.

The general syntax for sen2cor is the following:

L2A_Process --resolution XX S2A_OPER_xxxx

The xx in resolution should be replaced with the value of your choosing (10, 20 or 60) and S2A_OPER_xxxx should be the complete name of the main folder which is located in the directory you’re calling L2A_Process from.

So in your case I’d try this (after moving the product to C:\ ):

C:\> L2A_Process --resolution 10 S2A_OPER_PRD_MSIL1C_PDMC_20151224T201107_R066_V20151224T121712_20151224T121712.SAFE

Hth,

Val

2 Likes

I’m thinking if the problem could be the environment variables, do you have python installed and also anaconda? I have noticed that the tool environments in snap take python.exe without specifying the complete path and maybe this python is not the one which is installed with anaconda…

1 Like

Hi skudo,
have you solved the problem? I am so confused. :cry:

Hi tayi,
Try this: Go to menu tools --> manage external tools. Edit sen2cor tool and change the path to Anaconda’s python.exe (C:\Anaconda2 in my case). It worked for me.

If you have already processed an image, you should delete the folder created. If not, the tool will show you an error.

Hope it will work for you as well.

Hey skudo,
thanks for your quickly replying.

I cannot make clear what I should type in the blank of PYTHON_BIN’ Value. Did you mean that?

Best Regards
tayi

Ok, quick update everyone:
I managed to process an image.

Things I had to do to solve my problem:
PYTHON_BIN does not need a Path (C:\Anaconda…) as a value. It needs the the value “python.exe”. Everything else won’t work. At least in my case. The fact that a whole path as a value worked for Skudo does not make me less confused about this software. I needed to create a variable named PYTHON_BIN as a system variable in the Control Panel of Windows. Otherwise Sen2Cor did not accept the value. I also had to update everything, every module and Sen2Cor itself in SNAP. I needed to do this AFTER creating the system variable. Why? I don’t know.

Something did happen in the console windows! FINALLY! But it was…an error.

So after several hours I tried this one:

Now it works. In SNAP and as a standalone.
I got some bugs during the process, for example a DEM is needed, otherwise Sen2Cor assumes a flat surface. Now I have to figure out how get a DEM into the process. But thats enough stuff for a whole new forum topic. All I can say is that I solved my problem. It took me more than a week to figure everything out. I am not happy about it. But it runs now.

2 Likes

Hi tayi,
sorry for my late reply this time, I tried to write the path in the blank of PYTHON_BIN and worked. Probably this has no sense as Onishambles suggests but it worked. I have read in the forum that sometimes happen a tool is not working and after doing nothing it works. I think SNAP will be a powerful tool but we have to be patient because it needs to be polished.

Hi Omnishambles,
Can you please describe exactly how you create the system variable named PYTHON_BIN in the control panel (I’m a field ecologyst - and not very computer savvy).
Cheers

Sure!
I am working on a Windows 7 machine, so I can only explain it for Windows Users:

You go to the control panel of Windows and in there to the system properties. Once you are there you have to go to “Advanced System Settings”. In there you will click the tab “Advanced” and “Environment Variables…” at the bottom. Now you should see two lists of variables. One for the User and one for the whole system. In my case SEN2COR_BIN and SEN2COR_HOME are part of the user list, so I decided to create the PYTHON_BIN there as well. To create a new Variable click on “New…”. Now you have to enter the name and the value:

Name: PYTHON_BIN
Value: python.exe

Apply everythin with clicking “ok” and it should work. At least in my case.

Please let me know if it works for you.

If you are not able to find the menu you could also open the control panel and type “Environment Variables” in the control panel search. It should find the menu for you.

Cheers
Omnishambles

Thanks for your reply! Now I too have the black screen coming to an error, and probably need to implement Christian’s Workaround. Sorry to be daft, but how do I get ‘in’ to the L2A_Tables.py file in order to put in the workaround. I don’t want to go fumbling around with this file without being confident I’m doing the right thing. Cheers

L2A_Tables.py is in “C:\Users\YourName)\Anaconda2\Lib\site-packages\sen2cor-2.0.6-py2.7.egg\sen2cor”. So basically in your Anaconda installation folder. If you are not sure with edting this file you can make a backup. Just create a folder somwehere on your computer (Desktop for example) and copy the file there. So in the case of destroying L2A_Tables.py, you can always replace it with your backup copy to get back the original code lines again.

To get in to the L2A_Tables.py you have to open it with your standard Notepad, or better: with Notepad++ (it’s free).
In Line 1380++ you have to replace the function like Christian explains it. The most important thing is that the indentation of the codelines is exactly like in Christians code.
After that: Safe the file and it should work.

you are working with an outdated version of sen2cor. Please use the new vesrion 2.2.1 from here:
http://step.esa.int/main/third-party-plugins-2/sen2cor and read the release notes.
The problem with the windows oath names is fixed among lots of other issues.
There will not be any further support given on v.2.0.6.

Oh I did not know that, thanks very much! I will upgrade as soon as possible!

Hi umwilm,
I installed sen2cor 2.2.1 successfully and i have the same problem - after i tried to process Sentinel-2 Scene. Nothing happens and black console window appear.
Any idea how to proceed ?
Thanks,
Ori

Hi @ori.r
Plz did you manage to solve your problem ? Thanks ,D

I have the same problem using the sen2cor v.2.2.1 which I installed according to the default settings (i.e SNAP first, then anaconda according to the default settings, then sen2cor v.2.2.1 then integration of sen2cor in snap). The result is a black Processing screen which processes nothing… I will try the above suggestions by Omnishables and post back…