Installation

Orfeo Toolbox installation is straightforward:

  1. Download otb package for your OS. You can choose between:

  • A full package corresponding to your operating system in the package list. Archives are named OTB-<version>-<OS>. For Windows, “full package” is the only archive. You can find detailled explaination at recommended installation section.

  • Linux users can choose a lighter installation. You can install only Core package, or specifics modules. OTB dependencies can be resolved either with system packages or our dependencies archive (OTB-<version>-Linux-Dependencies in package download list). Commands are detailled at advanced-installation section.

  1. Configure OTB: source /Path/To/OTB/otbenv.profile

  2. Play with OTB in terminal (Command-line interface), as QGIS module (Use OTB in QGIS and QGIS interface) or in python scripts (Python API).

If you want the latests features, you might be interested to compile from source. Detailled steps at Compiling OTB from source.

OTB 9.x is known to work on:

Table 1 OTB compat list

Operating System

Minimum compiler required

Python version

Debian 11 and more & Ubuntu 20.04 and more

GCC 8

Python >= 3.8

RedHat 8

GCC 8

Python >= 3.8

Windows 10

MSVC 2019

Python 3.10

If you want to use another version of python you will need to recompile python bindings as explained in “Recompiling Python Bindings”.

If you plan to use OTB on other operating systems that thoses listed, you can either use Docker images or compile OTB from source (see Compiling OTB from source )

Linux

We provide a Core package and standalone optional packages to install over the Core for GNU/Linux x86_64. They include all of the OTB applications along with command line launchers. Since OTB 9.0, it is now possible to have a modular installation, you have to choose which package to download depending on your use case.

See the page OTB Modules to pick the ones you need.

Important note for RedHat / Fedora / Rocky users

If you are using Fedora, Redhat8, please download the package Linux_RedHat which contains GDAL bindings in a different folder than the standard Linux package. It is because the default system Python user site in RedHat, and distributions based on it, is lib/python3.8/site-packages and in ubuntu/debian it is lib/python3/dist-packages

Advanced Installation : Modular installation

Because OTB is a quite big software, the modular installation helps you to have only the needed software instead of all OTB. You need at least the Core and Dependencies modules and you can install only the components that matters to you.

Download

In order to run OTB you will need the OTB-Dependencies-9.0.tar.gz package to run the Core AND optional packages that you can install afterwards.

Let’s say you want to start using OTB only with the Core applications, and some months later you realize that you need to do more specific operations such as Learning. In that case you will just need to download the OTB-Learning package and its dependencies. You can then use directly the applications packaged in the Learning package alongside the other Core apps.

# Download mandatory packages to run OTB: Core and Dependencies
curl https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-9.0.0-Linux-Core.tar.gz -o OTB-9.0.0-Linux-Core.tar.gz
curl https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-9.0.0-Linux-Dependencies.tar.gz -o OTB-9.0.0-Linux-Dependencies.tar.gz
# Download optional packages, note that Learning needs FeaturesExtraction
curl https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-9.0.0-Linux-FeaturesExtraction.tar.gz -o OTB-9.0.0-Linux-FeaturesExtraction.tar.gz
curl https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-9.0.0-Linux-Learning.tar.gz -o OTB-9.0.0-Linux-Learning.tar.gz
...

Installation

These packages are self-extractable tar.gz archives. You may uncompress the files with: right-click ‣ Extract to ‣ folder-you-want or tar command line tool.

Unless specific needs we advice you to extract all packages on the same directory (like OTB-9.1.0). Nevertheless, since OTB-9.1 packages can be installed in different directories except for Core and Dependencies that should be on the same folder.

# Install each tar gz in the same "top level" folder
tar xvf OTB-9.0.0-Linux-Core.tar.gz --one-top-level="/Path/To/Install/OTB"
tar xvf OTB-9.0.0-Linux-FeaturesExtraction.tar.gz --one-top-level="/Path/To/Install/OTB"
# It is necessary to install the dependencies AFTER the other modules
tar xvf OTB-9.0.0-Linux-Dependencies.tar.gz --one-top-level="/Path/To/Install/OTB"
...
source /Path/To/Install/OTB/otbenv.profile

Be careful to install the dependencies AFTER the modules because the paths in the cmake files are made modular only when you install the dependencies : the resulting installation can be moved elsewhere on the disk. See the section “move installation below”

If you choose to install module in different folders the otbenv.profile script can not guess where you installed them, thus you must manually add module folders to the OTB_APPLICATION_PATH variable.

Installation folder description

Once the archive is extracted, the directory structure consists of:

  • otbenv.profile: A script to initialize the environment for OTB executables

  • recompile_bindings.sh : A script to recompile the python bindings with your system’s Python

  • bin: A folder containing application launcher (otbcli.sh)

  • lib: A folder containing all shared libraries and OTB applications.

  • include: A folder containing all the necessary headers to compile OTB based projects.

  • share: A folder containing common resources and copyright mentions.

If you want to use the otbcli launchers, you can initialize your environment with source otbenv.profile.

Python bindings

Our recommendation is to always recompile the python bindings when you install OTB

Since OTB 8.0.0 OTB bindings for Python 3.8 are distributed as a binary package. Please note that using a different Python version may not be compatible with OTB wrappings directly after installation. If the installation completes without issue, information relating to your Python bindings will be provided.

You must have Python NumPy bindings installed in your system. They can be installed locally without admin rights as follows: “pip install –user numpy”. This is to give users the option to select their own existing Python installation rather than the one dibstributed by the OTB package.

By default, bindings for Python 3.8 will be enabled with the otbenv script.

Recompiling Python bindings

If you are using another version of Python 3 than 3.8, but still want to use OTB Python bindings, it is possible to compile the python bindings again with your version of Python. CMake is required (it is available in most package managers or at [https://cmake.org/]). Make sure you installed the necessary dependencies in the First Steps page

At the root of the OTB installation run :

source otbenv.profile
sh recompile_bindings.sh

You should now be able to import otbApplication through Python !

Create an healthy Python environment for OTB

We strongly recommend to use a virtual env to avoid conflicts between OTB and GDAL when you develop python scripts that uses other dependencies like rasterio, scikit…

# Source your OTB environment
. <your installation directory>/otbenv.profile
# Create a virtual env and install some libraries
python -m venv otb_venv
. otb_venv/bin/activate
pip install --upgrade pip
pip install scikit-image scikit-learn geopandas
# Rastero depends on GDAL and need to be compiled on the flight with current OTB's own GDAL
pip install rasterio --no-binary :all:
# Use your libraries within Python
python
> import rasterio
> import otbApplication as otb

Notes:

  • Multiple installation of OTB can exists in same system without one conflicting the other!

Moving your installed OTB

With OTB 9 one can move the installation folder, but once it is done, there is a step to do to ensure the paths are correct.

rm /Path/To/Moved/OTB/tools/install_done.txt
source /Path/To/Moved/OTB/otbenv.profile
# At this time a message will be displayed showing that this is a new installation, this is normal

Windows

Before extracting the package, make sure that you have been through the First Steps page

Windows binary packages are available for Windows 10 or higher. They can be downloaded from otb download page .

Extract the zip archive and use one of the launchers, they contain all applications and their launchers (both command line and graphical launchers are provided):

  • otbenv.bat: A script to initialize the environment for OTB executables

  • bin: A folder containing application launchers (otbcli.bat) and the DLLs.

  • lib: A folder containing application DLLs.

  • include: A folder containing all the necessary headers to compile OTB based projects.

  • tool: A folder containing useful scripts to test the installation or to uninstall OTB libraries and headers while keeping all the dependencies.

If you want to use the otbcli launcher, you can initialize a command prompt with otbenv.bat.

The package can be used to compile other projects using OTB (binaries, libraries and headers are included). If you want to build OTB from source using this package, you should first uninstall the specific OTB files from the package to leave only the dependencies (what we call an XDK). You can do it using the supplied script tools/uninstall_otb.bat.

Python bindings

Since OTB 9.0.0, the bindings for Python 3.10 are distributed. Please note that using a different Python version may not be compatible with OTB wrappings. If the installation completes without issue, information relating to your Python bindings will be provided.

You must have Python numpy bindings installed in your system. They can be installed locally without admin rights as follows: “pip install –user numpy”. This is to give users the option to select their own existing Python installation rather than the one dibstributed by the OTB package.

By default, bindings for Python 3.10 will be enabled with the otbenv script.

Docker image

The following docker images are availables on DockerHub. It is the only way to run OTB for MacOS since the Intel architecture is no more in the Mac ecosystem.:

Table 2 Docker list for version 9.1

Tag

OS base

Python version

9.1.0

ubuntu 20.04

Python 3.8

9.1.0_ubuntu22

ubuntu 22.04

Python 3.10

9.1.0_ubuntu24

ubuntu 24.04

Python 3.12

It can be used on any device running Docker with the following instruction:

# you can adapt the version you want using different tag like orfeotoolbox/otb:9.1.0
docker pull orfeotoolbox/otb

To run CLI tools, you can launch the docker image with:

docker run -it orfeotoolbox/otb

If you are planning on using the image on MacOS with an Apple Silicon chip (M1,M2,M3) :

docker run -it --platform=linux/amd64 orfeotoolbox/otb:9.0.0

Distribution packages

Warning! These packages may not be up-to-date with latest OTB releases. In addition, some features of the library may not be available on every platform. Some of these are not maintained by the OTB-team. If you want to get involved in the packaging of OTB for your favourite platform, please contact us through the developer’s mailing list: otb-developers@googlegroups.com.

There are OTB packages for Debian (unstable) since version 5.2.0. OTB Applications packages may be available as Debian packages through APT repositories:

  • otb-bin for command line applications

  • python-otb for python applications

apt install otb-bin python-otb

Due to license issues, the OTB package built in Debian doesn’t contain 6S. As a consequence, the package does not contain the OpticalCalibration application.

This is why it is recommended to use the official binary package.