Access to Python API in Debian testing installation

Hi,

I installed otb via the Debian testing packages (cf list of installed packages below). However, the python bindings are not part of the Debian packages. Could someone indicate where I can find the python API (otbApplication.py) and how I can use it in Debian ?

Moritz


Installed otb Debian packages:
ii libotb 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library metapackage
ii libotb-apps 7.1.0+dfsg-1+b1 amd64 Plugins for ORFEO Toolbox applications
ii libotbapplicationengine-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBApplicationEngine
ii libotbcarto-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBCarto
ii libotbcommandline-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBCommandLine
ii libotbcommon-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBCommon
ii libotbcurladapters-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBCurlAdapters
ii libotbextendedfilename-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBExtendedFileName
ii libotbfuzzy-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBFuzzy
ii libotbgdaladapters-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBGdalAdapters
ii libotbice-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBIce
ii libotbimagebase-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBImageBase
ii libotbimageio-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBImageIO
ii libotbimagemanipulation-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBImageManipulation
ii libotbiobsq-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBIOBSQ
ii libotbiogdal-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBIOGDAL
ii libotbiokml-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBIOKML
ii libotbiolum-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBIOLUM
ii libotbiomstar-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBIOMSTAR
ii libotbioonera-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBIOONERA
ii libotbiorad-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBIORAD
ii libotblearningbase-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBLearningBase
ii libotbmapla-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBMapla
ii libotbmathparser-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBMathParser
ii libotbmathparserx-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBMathParserX
ii libotbmetadata-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBMetadata
ii libotbmonteverdi-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBMonteverdi
ii libotbmonteverdicore-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBMonteverdiCore
ii libotbmonteverdigui-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBMonteverdiGUI
ii libotbossimadapters-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBOssimAdapters
ii libotbossimplugins-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBOssimPlugins
ii libotbpolarimetry-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBPolarimetry
ii libotbprojection-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBProjection
ii libotbqtadapters-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBQtAdapters
ii libotbqtwidget-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBQtWidget
ii libotbsampling-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBSampling
ii libotbsiftfast-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBSiftFast
ii libotbstatistics-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBStatistics
ii libotbstreaming-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBStreaming
ii libotbsupervised-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBSupervised
ii libotbtestkernel-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBTestKernel
ii libotbvectordatabase-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBVectorDataBase
ii libotbvectordataio-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBVectorDataIO
ii libotbwavelet-7.1-1 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox library - OTBWavelet
ii otb-bin 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox command line applications
ii otb-bin-qt 7.1.0+dfsg-1+b1 amd64 ORFEO Toolbox graphical user interface applications
ii otb-i18n 7.1.0+dfsg-1 all ORFEO Toolbox translations


Hello,

you can download OTB from the binary packages (https://www.orfeo-toolbox.org/download/).

See this page for installation instructions.

The binary packages contains Python bindings for Python 3.7, if you need to use another python version it is possible to re-compile the python bindings from the binary packages by following these instructions.

I hope that helps,
Cédric

First, check if there are additional OTB Python packages available in the Debian repository.
Look for a package that provides OTB Python bindings. The package name might include “python” or “py” in its name.

  1. Install Python Bindings
    If you find a relevant package, install it using the following command (replace packagename with the actual package name):
    sudo apt-get install packagename

  2. Manual Installation
    If Debian packages don’t provide the Python bindings, you may need to manually download and install OTB with Python support.

Download OTB Source Code:
Visit the OTB website or GitHub repository to download the source code: OTB GitHub

Build OTB with Python Support:
Follow the build instructions provided in the OTB documentation. Typically, you need to configure the build with Python support enabled. Use the CMake tool to configure the build:
cmake -DOTB_WRAP_PYTHON=ON -DPYTHON_EXECUTABLE:PATH=/path/to/your/python .

Replace /path/to/your/python with the path to your Python interpreter.

Compile and Install:
After configuring, compile and install OTB:
make
sudo make install

  1. Virtual Environment
    Consider using a virtual environment to avoid conflicts with system packages. After installing OTB with Python bindings, you can create a virtual environment and install any additional Python packages you need:
    python3 -m venv otbenv
    source otbenv/bin/activate
    pip install your-required-packages

Remember to activate the virtual environment whenever you want to use OTB in Python.

  1. Python API Usage
    Once the Python bindings are installed, you can use the otbApplication module in your Python scripts as follows:
    from otbApplication import otbApplicationRegistry

Create an instance of an OTB application

app = otbApplicationRegistry.CreateApplication(“YourOTBApplication”)

Set parameters

app.SetParameterString(“in”, “input_image.tif”)
app.SetParameterString(“out”, “output_image.tif”)

Execute the application

app.ExecuteAndWriteOutput()

Following ViperStrike’s guidance can help you get the OTB Python bindings up and running on your Debian testing installation. Here’s a summarized version: Check Debian Repository: Look for OTB Python packages in the Debian repository. These packages usually have names containing “python” or “py.” Install from Repository: If you find a relevant package, install it using: sudo apt-get install packagename Manual Installation: If Debian packages lack Python bindings, consider manual installation.

I have the feeling that I’m getting commercial offerings here, not real advice.

OTB has been taken out of the Debian repositories altogether since July: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042496. So my original question is moot anyway in these circumstances.

You are right this account seems to use an IA produced text, this is not its first post, and I have the same feeling. we will be moderating that very soon

Regards