Python 3.9 bindings

Hello,

I would like to use orfeos Python bindings from Python 3.9 on Debian linux. The documentation suggests that it is possible to build the binds for a target version of Python rather than 3.5 (which is now EOL). Has anyone has success doing this? Has any hints or tips?

Can I compile the whole of orfeo-toolbox from source with a target python version?

Thanks in advance,

Ills

Hello,

Using the OTB binary packages, it is possible to recompile the python bindings for a specific python version:

cd OTB_DIR
source otbenv.profile
ctest -S share/otb/swig/build_wrapping.cmake -VV

I just tried with success on Ubuntu using python 3.9 from conda. Note that Numpy and Cmake are required.

If you wish to recompile OTB from sources, you can have a look at this page. To compile the python bindings the OTB_WRAP_PYTHON CMake variable should be set to ON, and the PYTHON_EXECUTABLE to the location of the python executable (if the defaut python is not used).

I hope that helps,
CĂ©dric

1 Like

Thanks for the help Cedric,

I had tried what was detailed in the docs and as per your last message, but was getting the an error in both a debian container (python3.9:slim buster from the official docker repo) and my own Debian based (pop_os_20.10) system.

In both cases what I found after some investigation was that I needed to install OpenGL, using apt-get install libgl1-mesa-dev did the trick. Would you accept a very small PR on the docs with this note?

Thanks,
Ills

Would you accept a very small PR on the docs with this note

Sure !

I am not sure why openGL is required here. OpenGL is required to compile the visulaization tools (Monteverdi), but it shouldn’t be required to compile the Python, I think there is something wrong in the CMake code here.

CĂ©dric