DLL Error when running from python notebook on windows 10

#1

Dear All,
I have the same issue as mentioned in this post: https://groups.google.com/forum/#!topic/otb-users/TMjOHJEKvlE. When performing import otbApplication i get the same DLL import error.

Here the mentioned solution is to switch OS from windows to linux, witch is not an option for me.

My error message is:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
C:\Orfeo_toolbox\OTB-6.6.1-Win64\OTB-6.6.1-Win64\lib\python3\otbApplication.py in swig_import_helper()
13 try:
—> 14 return importlib.import_module(mname)
15 except ImportError:

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\__init__.py in import_module(name, package)
        126             level += 1
    --> 127     return _bootstrap._gcd_import(name[level:], package, level)
        128 

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\_bootstrap.py in module_from_spec(spec)

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\_bootstrap_external.py in create_module(self, spec)

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

    ImportError: DLL load failed: The specified module could not be found.

    During handling of the above exception, another exception occurred:

    ImportError                               Traceback (most recent call last)
    <ipython-input-2-441603f327e2> in <module>
    ----> 1 import otbApplication

    C:\Orfeo_toolbox\OTB-6.6.1-Win64\OTB-6.6.1-Win64\lib\python3\otbApplication.py in <module>
         15         except ImportError:
         16             return importlib.import_module('_otbApplication')
    ---> 17     _otbApplication = swig_import_helper()
         18     del swig_import_helper
         19 elif _swig_python_version_info >= (2, 6, 0):

    C:\Orfeo_toolbox\OTB-6.6.1-Win64\OTB-6.6.1-Win64\lib\python3\otbApplication.py in swig_import_helper()
         14             return importlib.import_module(mname)
         15         except ImportError:
    ---> 16             return importlib.import_module('_otbApplication')
         17     _otbApplication = swig_import_helper()
         18     del swig_import_helper

    ~\AppData\Local\Continuum\anaconda3\lib\importlib\__init__.py in import_module(name, package)
        125                 break
        126             level += 1
    --> 127     return _bootstrap._gcd_import(name[level:], package, level)
        128 
        129 

    ImportError: DLL load failed: The specified module could not be found.

Therefore, I would like to know what im doing wrong.

I am using python version 3.7 and the output of print(sys.path) is:

[ 'C:\\Orfeo_toolbox\\OTB-6.6.1-Win64\\OTB-6.6.1-Win64\\lib\\python3', 'C:\\Orfeo_toolbox\\OTB-6.6.1-Win64\\OTB-6.6.1-Win64\\bin', 'C:\\Orfeo_toolbox\\OTB-6.6.1-Win64\\OTB-6.6.1-Win64\\lib', 'C:\\Orfeo_toolbox\\OTB-6.6.1-Win64\\OTB-6.6.1-Win64\\lib\\otb\\applications', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3\\python37.zip', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3\\DLLs', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3\\lib', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3', '', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Roaming\\Python\\Python37\\site-packages', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Users\\matthijsbernd.ooster\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\matthijsbernd.ooster\\.ipython']

Anyone has a clue how to fix the DLL import error in the python otbApplication import?
Many thanks in advance,
Thijs

0 Likes

#2

Hi Matthis,
Unfortunately I am not sure we can help you. Python bindings are made on python 3.5, not 3.7. Thus your error might be link to this (not sure but maybe…). If you can downgrade your python it might work.
Antoine

0 Likes