cannot import otbApplication in python shell
Mantis Issue 1108, reported by hakim, assigned to rkanavath, created: 2015-11-18
Hi,
I've installed otb and python-otb using the repo on Ubuntu 14. But after the install the python wrapper could not be imported (import otbApplication), although I can locate it in /usr/lib/otb/python/*py.
If I compile the library from the source, would it solve this problem?
As a workaround, I added /usr/lib/otb/python/ to PYTHONPATH (inside ~/.bashrc) and added also a init.py file inside the same folder, to get it imported inside the python shell.
Thanks.
2015-12-09 09:53 - gpasero: To my knowledge, this is not a real bug. You actually need to setup your PYTHONPATH in order to import otbApplication. I don't think the init.py is necessary. You may also have to set the environment variable ITK_AUTOLOAD_PATH to /usr/lib/otb/applications
2016-04-11 16:35 - poughov: I would argue this is actually a bug in our ubuntu package (not in otb itself necessarily). When I do "apt-get install numpy", I can launch a python REPL and type "import numpy" without touching the PYTHONPATH. I am not a packaging expert but why isn't that possible for OTB?
2016-04-11 16:38 - poughov: I'm reopening this because I would like to see more discussion about the point I raised previously. We can decide it's a future improvement if need be.
2016-04-11 16:55 - rashadkm: To start with,
/usr/lib/otb/python is not the standard path where python packages are installed.
I guess changing that would fix the issue.
There is already OTB_INSTALL_PYTHON_DIR which is set to "lib/otb/python". Most of the linux packages find the system python site-packages directory and use it with OTB_INSTALL_PYTHON_DIR.
A bit of pre-configure stuff needed in packaging. But I think this is possible.
2016-04-11 16:55 - rashadkm: TODO for packaging.
2016-04-11 16:55 - ludovic: patch created, will be applied for 5.10 packaging.