How can I "install" and use Orfeo Toolbox (OTB) through python 3.6 (NO Conda)?

Using Python v.3.6.8 through Jupiter notebook (in Windows 10), how can I set and use OTB (v.7.3.0)? I followed the steps described in the official cookbook and other tutorials, however, the result is:

No module named 'otbApplication'

Many people encounter the same problem. Could anyone who has already solved this problem describe the various steps (starting from scratch) once and for all, please?
The community would be grateful.

Hey Jando 93,

Did you manage to solve this issue? I face up the same problem

Ok, I managed to solve this issue. You need to follow these steps (at least in my case it works):

  1. Install Python 3.5.4 (Standalone)

  2. Unzip the Orfeo Toolbox folder in C:/…

  3. Create 3 environment variables

    PATH → C:\OTB-7.4.0-Win64\bin
    PYTHONPATH → C:\OTB-7.4.0-Win64\lib\python; C:\OTB-7.4.0-Win64\bin
    OTB_PYTHON_APPLICATION → C:\OTB-7.4.0-Win64\lib\otb\applications

  4. Open Python 3.5.4 and install numpy library

  5. Then, type import otbApplication (it’s DONE)

My next question is if anyone knows how to make it in anaconda… I created another environment with python 3.5.6 but it doesn’t work…

1 Like

Hi valexandridis,

thanks for your contribute!! I hadn’t solved the issue yet!

What I’ve understood is that it could be a problem with the OTB version.

However, I’ll try the steps you suggested in both versions next days. I’ll let you know.

No idea concerning Anaconda, for now.

Hi,

OTB 7.x python bindings are provided for Python 3.5 so if you want it to work with your python 3.6, you need to recompile the python bindings.
First step : you need to install system dependencies
For debian/ubuntu, type :
apt install g++ cmake make python3 python3-dev python3-numpy

There are other OTB dependencies to fullfill to rebuild the bindings:
apt install ‘^libxcb.*-dev’ libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev

Second step : you can recompile the bindings by doing :
cd /path/to/InstalledOTB
source otbenv.profile
ctest -S share/otb/swig/build_wrapping.cmake -VV

As it is needed by the community, we have integrated this tutorial to the cookbook for the upcoming release 8.0. Which will comme with python 3.8 bindings
Let me know if it works for you
Best Regards