Could not create OGR driver SQLite

Hi everyone,
recently I am doing some vector classifications and all applications run smoothly in OTBcommandLine but in python whenever a sqlite file is called (whether created or called to open) the following error appears:

itk::ERROR: Could not create OGR driver SQLite, check your OGR configuration for available drivers.
or if an existent sqlite file is called:
itk::ERROR: Failed to open GDALDataset file /workspace/data/samples_training.sqlite :

below I copied the python code which returns error :

SampleSelection = otbApplication.Registry.CreateApplication(“SampleSelection”)

SampleSelection.SetParameterString(“in”, ‘/workspace/data/REFLEC_VEG_INDEX_DO_2019-01-22.tif’)
SampleSelection.SetParameterString(“out”, “/workspace/data/samples_training.sqlite”)
SampleSelection.SetParameterString(“vec”, ‘/workspace/data/Donana_v2.shp’)
SampleSelection.UpdateParameters()
SampleSelection.SetParameterString(“field”, “clc12”)

SampleSelection.SetParameterString(“instats”, “/workspace/data/classes_training.xml”)
SampleSelection.SetParameterString(“outrates”, “/workspace/data/rates_training.csv”)
SampleSelection.SetParameterString(“strategy”, “byclass”)
SampleSelection.SetParameterString(“strategy.byclass.in”, “/workspace/data/byClass_training.csv”)
SampleSelection.UpdateParameters()

whereas the following commandLine version function properly:

otbcli_SampleSelection -in /workspace/data/REFLEC_VEG_INDEX_DO_2019-01-22.tif -vec /workspace/data/Donana_v2.shp -instats /workspace/data/classes_training.xml -field clc12 -strategy byclass -strategy.byclass.in /workspace/data/byClass_training.csv -outrates /workspace/data/rates_training.csv -out /workspace/data/samples_training.sqlite

Has someone ever got this error? Is it related to some environmental variable? :thinking:
Thank you for any help or suggestions.

1 Like

Hi,

Can you file a bug report here : https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues ?

We will see if we can reproduce this bug. Also include OS, OTB version and where you got the binaries from (downloaded from OTB website or built on your own).

Regards,

Julien

Hi,
I cannot reproduce your bug. I tried a similar pipe in python but I have no error.
Can you tell us what configuration you are using:

  • platform you are on
  • if you are from source or with binaries
  • what python you are using

Hello Antoine & Julien
I have CentOS 6.7, kernel 2.6.32-573.7.1.el6.x86_64 ,installed OTB 6.6.1 from binaries. The environmental variables I have set as follows:

`sys.path.append(’/opt/anaconda/bin/’)

sys.path.append(’/opt/OTB-6.6.1/lib/python’)
sys.path.append(’/opt/OTB-6.6.1/lib/libfftw3.so.3’)
sys.path.append(’/opt/OTB-6.6.1/bin’)
os.environ[‘OTB_APPLICATION_PATH’] = ‘/opt/OTB-6.6.1/lib/otb/applications’
os.environ[‘LD_LIBRARY_PATH’] = ‘/opt/OTB-6.6.1/lib’
os.environ[‘ITK_AUTOLOAD_PATH’] = ‘/opt/OTB-6.6.1/lib/otb/applications’
os.environ[‘GDAL_DATA’] = ‘/opt/OTB-6.6.1/share/gdal’
import otbApplication`

Thank you.
Best
Panteha

I’m sorry but I still cannot reproduce your bug…
What kind of stuff do you have under /opt/anaconda/bin/? Can you try to append this path after otb one?

sys.path.append("/opt/OTB-6.6.1/lib/python")
sys.path.append("/opt/OTB-6.6.1/lib/libfftw3.so.3")
sys.path.append("/opt/OTB-6.6.1/bin")
sys.path.append("/opt/anaconda/bin/")

On the other hand for your example to work I do not need any of the sys.path.append call (except for the one setting “/opt/OTB-6.6.1/lib/python”).
Did you manage to make your example work without the conda path?

Hi Antoine,
I changed the order of the commands as you suggested:
sys.path.append('/opt/OTB-6.6.1/lib/python') sys.path.append('/opt/anaconda/bin/')

all OTB operators which do not involve a sqlite file works properly.
I have no explanation why python version of OTB operators do not recognise sqlite type.
As a workaround I changed the type of the files in the process from sqlite to shapefile and bypassed the problem.