Just noticed that you work on windows: here the gdaltools are located in “Your_Anaconda_installation_directory”\Library\bin, but the gereral principles are the same as described below. The question which tools are used are dependent on the arrangement of the path environment variable.
Let me first check whether I have understood your problem:
is it the case that you have a more recent version of the gdaltools installed (supporting JP2, somewhere outside of anaconda) which is now no longer reachable, after installation of anaconda, resp. the installation of the gdaltools inside of anaconda?
If yes, this is a problem of how anaconda sets it’s own environment: you will find (either in your .bashrc or in .profile) the following entry by anaconda:
//# added by Anaconda2 4.3.1 installer
Anaconda installs all gdal tools in it’s own bin directory (see above) and this is the reason why your (more recent) gdal tools are no longer found afterwards. See:
but you can do the following:
//# this is my environment on OSX, your’s is dependent on where you installed the gdal tools:
$> export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH
afterwards, your own gdaltools are reachable again:
$> which gdalinfo
//# this is my environment, your’s is dependent on where you installed the gdal tools:
Sen2Cor itself does not modify the path to use explicitly gdal 2.1. It completely depends on the Anaconda setup. You will even see that the path for GDAL_DATA inside of the L2A_Bashrc does not point to any GDAL version (as you state). It simply points to a directory in it’s own home environment where some essential geo-information is located, but this is completely local.
Sen2Cor also does not use the JP2 drivers: we had the same problems you describe (no support of JP2 for some gdal versions) - this is why we switched to the Glymur/OpenJPEG drivers. GDAL inside of Sen2Cor is only used for assembling the Digital Elevation Models, if this feature is selected via configuration but it is not used for en/decoding the JP2 images.
To upgrade GDAL inside of Anaconda, might be possible, but we do not support you in this issue, as it is not required by Sen2Cor and it apparently provokes some dependency problems (see Cannot read JPEG2000 anymore after installing SNAP). This might also be the reason why anaconda still installs the 2.1 baseline.
So for the workaround, we recommend that you set the PATH environment according to the GDAL Version you need (for your other purposes), as demonstrated above.
Hope this helps.