Discussion:
[otb-users] import otbApplication in IDLE
CyberGIS
2017-07-01 22:22:32 UTC
Permalink
Hi all,

I have downloaded OTB-contrib-6.0.0-win64.zip from the Download page
(https://www.orfeo-toolbox.org/download/). Since I use ArcGIS, I would like
to use python with IDLE to run orfeo toolbox functions.

In IDLE, when I enter >>> import otbApplication, I get the following error:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import otbApplication
ImportError: No module named otbApplication

I do not know how to set the python path. Can someone please help me step
by step, or point me to a good online resource, to get it working?

Thank you very much!
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-***@googlegroups.com
To unsubscribe from this group, send email to
otb-users+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otb-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
CyberGIS
2017-07-04 23:08:48 UTC
Permalink
I've made a little progress, but still can't import otbApplication in IDLE
(WIndows) successfully.

I added 'PYTHONPATH' system variable in environment variables, and added
the path to the python folder under the OTB software folder, i.e.
...\lib\python

Now when I import otbApplication in IDLE I get this error:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import otbApplication
File "C:\Software\OTB-contrib-6.0.0-win64\lib\python\otbApplication.py",
line 21, in <module>
_otbApplication = swig_import_helper()
File "C:\Software\OTB-contrib-6.0.0-win64\lib\python\otbApplication.py",
line 20, in swig_import_helper
return importlib.import_module('_otbApplication')
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: DLL load failed: The specified module could not be found.


I'm stuck here. Any help would be greatly appreciated. Thank you!

Cheers
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-***@googlegroups.com
To unsubscribe from this group, send email to
otb-users+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otb-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Guillaume Pasero
2017-07-05 13:34:38 UTC
Permalink
CyberGIS
2017-07-07 21:26:48 UTC
Permalink
Hi Guillaume,

Thank you for your reply. I looked at the otbenv.cmd file as you suggested,
and it seems to point to the bin directory inside current script dir as
follows:

set CURRENT_SCRIPT_DIR=%~dp0

set PATH=%CURRENT_SCRIPT_DIR%\bin;%PATH%

set GDAL_DATA=%CURRENT_SCRIPT_DIR%\share\gdal

set GEOTIFF_CSV=%CURRENT_SCRIPT_DIR%\share\epsg_csv



I have all the the dll files in the bin folder since I didn't modify
anything. I still am unable to import otbApplication in IDLE. Am I missing
something?

Cheers
Hi,
The first point to investigate is the PATH variable. In the OTB package,
there is a otbenv.cmd script that setup the environment. You should have a
look at how the PATH variable is set. Maybe the OTB dll's are not in your
PATH, and the python module can't be imported.
Guillaume
I've made a little progress, but still can't import otbApplication in IDLE
(WIndows) successfully.
I added 'PYTHONPATH' system variable in environment variables, and added
the path to the python folder under the OTB software folder, i.e.
...\lib\python
File "<pyshell#0>", line 1, in <module>
import otbApplication
File "C:\Software\OTB-contrib-6.0.0-win64\lib\python\otbApplication.py",
line 21, in <module>
_otbApplication = swig_import_helper()
File "C:\Software\OTB-contrib-6.0.0-win64\lib\python\otbApplication.py",
line 20, in swig_import_helper
return importlib.import_module('_otbApplication')
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: DLL load failed: The specified module could not be found.
I'm stuck here. Any help would be greatly appreciated. Thank you!
Cheers
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
<javascript:>
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
<http://www.c-s.fr> *Guillaume PASERO*
Responsable technique
*Business Unit ESPACE & GeoInformation - Département Payload Data &
Applications*
*CS SystÚmes d'Information*
Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
31506 Toulouse Cedex 05 - FRANCE
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-***@googlegroups.com
To unsubscribe from this group, send email to
otb-users+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otb-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
CyberGIS
2017-07-09 23:08:24 UTC
Permalink
Looks like I have resolved the issue. Here's what I did.

In System Properties > Environment Variables > System variables, I added
two paths (Variable > Value) as follows,

1. PYTHONPATH > C:\Software\OTB-contrib-6.0.0-win64\lib\python
2. Path > C:\Software\OTB-contrib-6.0.0-win64\bin

Adjust the paths to your 'python' and 'bin' folders according to where you
have unzipped the OTB application.

Cheers
Post by CyberGIS
Hi Guillaume,
Thank you for your reply. I looked at the otbenv.cmd file as you
suggested, and it seems to point to the bin directory inside current script
set CURRENT_SCRIPT_DIR=%~dp0
set PATH=%CURRENT_SCRIPT_DIR%\bin;%PATH%
set GDAL_DATA=%CURRENT_SCRIPT_DIR%\share\gdal
set GEOTIFF_CSV=%CURRENT_SCRIPT_DIR%\share\epsg_csv
I have all the the dll files in the bin folder since I didn't modify
anything. I still am unable to import otbApplication in IDLE. Am I missing
something?
Cheers
Hi,
The first point to investigate is the PATH variable. In the OTB package,
there is a otbenv.cmd script that setup the environment. You should have a
look at how the PATH variable is set. Maybe the OTB dll's are not in your
PATH, and the python module can't be imported.
Guillaume
I've made a little progress, but still can't import otbApplication in
IDLE (WIndows) successfully.
I added 'PYTHONPATH' system variable in environment variables, and added
the path to the python folder under the OTB software folder, i.e.
...\lib\python
File "<pyshell#0>", line 1, in <module>
import otbApplication
File "C:\Software\OTB-contrib-6.0.0-win64\lib\python\otbApplication.py"
, line 21, in <module>
_otbApplication = swig_import_helper()
File "C:\Software\OTB-contrib-6.0.0-win64\lib\python\otbApplication.py"
, line 20, in swig_import_helper
return importlib.import_module('_otbApplication')
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: DLL load failed: The specified module could not be found.
I'm stuck here. Any help would be greatly appreciated. Thank you!
Cheers
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
<http://www.c-s.fr> *Guillaume PASERO*
Responsable technique
*Business Unit ESPACE & GeoInformation - Département Payload Data &
Applications*
*CS SystÚmes d'Information*
Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
31506 Toulouse Cedex 05 - FRANCE
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-***@googlegroups.com
To unsubscribe from this group, send email to
otb-users+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otb-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
CyberGIS
2017-07-09 23:27:16 UTC
Permalink
I seem to have found a solution. Not sure if this is enough to successfully
run otb applications. Here's what I did anyway.

In System Properties > Environment Variables > System variables, I added
three paths (Variable > Value) as follows,

1. PYTHONPATH > C:\Software\OTB-contrib-6.0.0-win64\lib\python
2. Path > C:\Software\OTB-contrib-6.0.0-win64\bin
3. OTB_APPLICATION_PATH >
C:\Software\OTB-contrib-6.0.0-win64\lib\otb\applications

Adjust the paths to your 'python' and 'bin' folders according to where you
have unzipped the OTB application.

Cheers
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-***@googlegroups.com
To unsubscribe from this group, send email to
otb-users+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otb-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Guillaume Pasero
2017-07-12 16:23:13 UTC
Permalink
s***@gmail.com
2018-11-13 13:28:14 UTC
Permalink
Hi,
Is that working for you, i followed the same setting all the paths, but
still i am getting error as given below.


import otbApplication
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:/PROGRA~2/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607,
in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "E:\Amrut\software\OTB\lib\otb\python\otbApplication.py", line 21,
in <module>
_otbApplication = swig_import_helper()
File "E:\Amrut\software\OTB\lib\otb\python\otbApplication.py", line 20,
in swig_import_helper
return importlib.import_module('_otbApplication')
File "C:\PROGRA~2\QGIS2~1.18\apps\Python27\lib\importlib\__init__.py",
line 37, in import_module
__import__(name)
File "C:/PROGRA~2/QGIS2~1.18/apps/qgis/./python\qgis\utils.py", line 607,
in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: DLL load failed: %1 is not a valid Win32 application.


if possible, please help me out.

with
Thanks and Regards,
Sampath
Hi,
Okay, it seems to be the right solution. The otbenv.cmd script will be
fixed in the next release.
Regards,
Guillaume
I seem to have found a solution. Not sure if this is enough to
successfully run otb applications. Here's what I did anyway.
In System Properties > Environment Variables > System variables, I added
three paths (Variable > Value) as follows,
1. PYTHONPATH > C:\Software\OTB-contrib-6.0.0-win64\lib\python
2. Path > C:\Software\OTB-contrib-6.0.0-win64\bin
3. OTB_APPLICATION_PATH >
C:\Software\OTB-contrib-6.0.0-win64\lib\otb\applications
Adjust the paths to your 'python' and 'bin' folders according to where you
have unzipped the OTB application.
Cheers
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
<javascript:>
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
<http://www.c-s.fr> *Guillaume PASERO*
Responsable technique
*Business Unit ESPACE & GeoInformation - Département Payload Data &
Applications*
*CS SystÚmes d'Information*
Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
31506 Toulouse Cedex 05 - FRANCE
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-***@googlegroups.com
To unsubscribe from this group, send email to
otb-users+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otb-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...