I am using Orfeo Toolbox for orthorectification inside python Anaconda Environment in Windows.
I have set all the Environment Variable for Windows, created Virtual Environment for Python 3.5.4
otbApplication is getting imported without any problem.
Now, in the Anaconda Virtual Env, I also have gdal installed. The issue is that these two packages can’t be imported together. They cause the following error:
ImportError: DLL load failed: The specified procedure could not be found.
If I try to import gdal first followed by otbApplication then the above error is caused by otbApplication
If I import otbApplication First and then gdal then gdal causes the same above stated error.
Is there a way around it.
import otbApplication as otb
from osgeo import gdal
Following this instructions may solve your issue. I hope this helps.
Thanks for the reply!
Just one question, in the statement:
So if you need OTB, you should use the GDAL from your OTB installation. To do so, you need your OTB path to be first in PATH and PYTHONPATH (at least before your own GDAL installation).
What does use GDAL from OTB mean? How can I use the gdal from my otb. Does the command remain
from osgeo import gdal or does it change? (considering environment variables are set)
GDAL is included in the OTB installation. This means you potentially have two GDAL present in your PYTHONPATH.
When python reads
from osgeo import gdal in your script, it will try to find this library by checking all the directories in your PYTHONPATH, and it will use the first it finds. To be sure it uses the GDAL included in OTB, you need to check your PYTHONPATH to be sure that the directory containing OTB’s GDAL appear before the directory containing GDAL.