Sen2cor install (win64): issues with path environments _HOME, _BIN

Dear colleagues,

We are trying to install the sen2cor processor in SNAP in order to perform atmospheric corrections in S2 LC1 products.

We first tried to directly install the plug-in through the SNAP/tools/plugins, but, as it is mentioned in some similar posts in this forum, it is required to first install the sen2cor processor independently from SNAP. Therefore we followed the procedure described in the Telespazio Vega User Manual, p. 29. Using a Win-7 64bit computer, we did the following:

  1. Install of Anaconda2 - 2.4.1v 64 bit (2.7 Python); all install options as default (e.g. in “Advanced options”, we accepted both options): successful installation.

  2. Install of sen2cor via the unzipped folder “sen2cor-2.0.6”, which was opened in the command prompt to perform the call python setup.py install. At the end of the installation, as suggested by the manual, we kept the home directory as default.

2.1) The installation of sen2cor looks successfully complete. However, looks like the installation have failed in recognize the path for the environments _DATA, _HOME and _BIN (see attached image below).

2.2.) Despite the setting environment message above, we successfully tested the processor via the call 2A_Process --help, as indicated by the manual (see attached image below):

  1. Once we “successfully” installed sen2cor, we downloaded the plug-in from SNAP/tools/plugins and tested it with a S2 LC1 product. We got this error message:

    Before executing the tool, please correct the errors below:
    Variable SEN2COR_HOME is not set
    Variable SEN2COR_BIN is not set

Which automatically opens a sen2cor window with adjustable parameters for the system variables, in which the value for the keys HOME and BIN are empty, while the value for the PYTHON_BIN is “python_exe”.

Do you have any comment of how to solve this issue and therefore install the sen2cor environments properly? We are new to S2 toolbox and we are not python experts. We think there might be an error in the ways the paths are located and tracked, but perhaps is something far more simple!

Thank you!

Hello,
i think you sholud uninstall sen2cor and Anaconda. By commandline use pip uninstall sen2cor (click yes) and next delete folder with environment settings (if was created) Next uninstall Anaconda and install again in properly path (dont change path. Installer ought to want install anaconda in C disk folder Anaconda2). Install again sen2cor.

Hi kyril23,

Thanks for posting. Unfortunately it didn’t work. Sen2cor in SNAP shows the same message:

> Before executing the tool, please correct the errors below: 
> Variable SEN2COR_HOME is not set
> Variable SEN2COR_BIN is not set

After which this window appears:

Any clue about how to configure the system variables value from here?

Many thanks,

Francesc

You should be able to update the SEN2COR_HOME and SEN2COR_BIN by double clicking on the “value” field.
SEN2COR_HOME in your case should be set to C:\Users\Frans_Home\documents\sen2cor
SEN2COR_BIN should be set to C:\Users\Frans_Home\Anaconda2\Lib\site-packages\sen2cor-2.0.3-py2.7.egg\sen2cor
However something is not right since these variables should be set automatically by the Sen2Cor installation, and you should see these paths with “echo %SEN2COR_HOME%” and echo “%SEN2COR_BIN%”

After uninstalling and reinstalling SNAP, Anaconda and Sen2cor and configuring the path, I tried to perform the sen2Cor process on S2A data and ended up with this error message, would anyone help me out please?

Maybe this helps:

I cannot find the path of C:\Users\Frans_Home\Anaconda2\Lib\site-packages\sen2cor-2.0.3-py2.7.egg\sen2cor

Where did you install Anaconda?

If you use the latest version of sen2cor this is no longer needed as it comes as a standalone installer.

Excuse me ABraun , i installed sen2cor standallone version in window command prompt.
These are the environmental variables. I have also installed snap.
I tried many times to atmospherically correct an image of sentinel 2 through the commant prompt and sen2cor but it didn’t work.
Can i do the correction through snap as the sen2cor has succesfully been installed?

thanks in advance
R

Also i type in command prompt
L2A_Process.bat --resolution 10 C:\S2A_MSIL1C_20171016T092031_N0205_R093_T34SFH_20171016T092740.SAFE
but also it didn’t work

Another try

can you please specify what exactly didn’t work? Otherwise we can’t help you.

Hi @rinokeros,

you have to navigate in the command prompt to the folder where you have installed sen2cor and run it from there, if not, it will not find where is the executable. For example:

Another alternative is to include the path of your installation folder in the PATH.

It seems that i succesfully installed sen2cor (standalone version) . Now i have problem in atmospherically correct an image of sentinel 2, as you can see bellow

i tried again many times. At the end after 1 or 2 hours of processing ,the sen2cor terminated succesfully (resolution 20m) . From the new file that has been created the only image that opens in snap , is the MTD_MSIL2A. I suppose that this is the atmospherically corrected image. About the resolution of 10 m there is an error about the memory.
I run again sen2cor for 10 resolution and its fine!
The standalone version is super, easier and faster to install!!!
I can understand that i am not expert so i consume your time.
Thanks in advance
R