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

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…

Hi Daniel,
Yes, i solve the problem according Omnishambles answer here - Sen2Cor does not start to process (and does not return any errors)

Ori

Hello everyone, despite all comments regarding a positive solution on the issue of “the black console window with no process”, I haven’t manage to get a solution myself. I still have the same problem and i’ve tried everything described for each one of you that appeared as a possible solution. Is there a clean way out to this problem? I have SNAP 4.0 and all new versions of Anaconda and Sen2Cor 2.2.1 installed and integrated. I left default paths to all environment variables. I also gave new paths after all error messages when started the tool at any resolution. I don’t know if i’m missing any step in order to get this thing right. Also, i moved the product close to C:.
I’d appreciate some help please!!

Best regards

I have the same situation, and have done for months. I updated SNAP to version 4. I followed the release notes for the latest Sen2Cor (update conda, update anaconda, unistall previous sen2cor, reinstall new version via command line, integrate with Snap), but although the processor starts, it fails after about 6 seconds, regardless of resolution. So frustrating - I’m sick of trying to get it to work and failing. I wish there was an option to obtain the products pre-processed as there is with USGS landsat data.

Hi, Reflectance, this is what I did and now Sen2cor is working:

I re-installed everything from scratch, changing two things from the very beginning :

  1. I assigned a path to python.exe from the anaconda install wizard at the beginning of the installation
  2. As I was installing SEN2COR I realized in the command prompt SEN2COR_HOME was assigned a path and that location was different from what I had set in my system variables, so I changed it.
  3. And the rest of my system variables look like this:

Now i’m trying to solve the 10m resolution issue of the correction. If you have any questions just let me know.

Good luck!