OTB installation causes conflict with QGIS and R (ubuntu 20.1)

The standard OTB installation
https://www.orfeo-toolbox.org/CookBook/Installation.html

causes a conflict of proj for QGIS and R:

The conflict is caused by the OTB installation, which has its own proj (but 7.1 !)
/home/alobo/OTB/OTB-7.3.0-Linux64/bin/proj
I realized this fact thanks to rgdal, which reports:

Path to PROJ shared files: /home/alobo/OTB/OTB-7.3.0-Linux64/share/proj

If I remove the OTB installation and restart, the problems are solved both in QGIS and in R, and I can successfully
install terra, and sf. The rgdal installation, which always worked, reports another proj path:

Path to PROJ shared files: /home/alobo/.local/share/proj:/usr/share/proj

Unfortunately, If I install OTB even after having installed the R packages, I go back to problems in QGIS
and rgdal reports the OTB path for rproj again.

Is not there a way to get OTB use its own proj path but not setting a global proj path, so that other packages are not conflicted?
For example, using

#set GDAL_DATA variable used by otb application
OTB_GDAL_DATA=/home/alobo/OTB/OTB-7.3.0-Linux64/share/gdal
OTB_PROJ_LIB=/home/alobo/OTB/OTB-7.3.0-Linux64/share/proj

instead of GDAL_DATA and PROJ_LIB

Hello,

If I understand correctly, you have OTB installed in /home/alobo/OTB/OTB-7.3.0-Linux64/ (from binary packages I guess). What do you mean by install OTB ? sourcing otbenv.profile ? Something like

cd /home/alobo/OTB/OTB-7.3.0-Linux64/
source otbenv.profile
qgis # Cannot find proj paths

I think this has something to do with the PROJ_LIB variable set by otbenv.profile.

Can you try:

source otbenv.profile
export PROJ_LIB=/home/alobo/.local/share/proj:/usr/share/proj:/home/alobo/OTB/OTB-7.3.0-Linux64/share/proj
qgis

I think there is only a conflict in the proj data used by PROJ 7.1 and 7.2 here, not a conflict in the PROJ libraries.

Cédric

All applications seem to work fine by modifying PROJ_LIB in otbenv.profile as you indicate. I’ll report back in case of problems.
Thanks