[gdal-dev] Help with GDAL/OGR Python API and OCI

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Help with GDAL/OGR Python API and OCI

Alejandro Saucedo
Hello,
Please, your help with the following problem. 
I am not able to see the Oracle OCI driver from python using the GDAL/OGR bindings.
The following code prints always None:
    from osgeo import ogr
    print(ogr.GetDriverByName( 'OCI' ))
 Also, the driver is never listed here:
    drivers = [ogr.GetDriver(i).GetDescription() for i in range(ogr.GetDriverCount())]
    drivers.sort()
    print(drivers)
['ARCGEN', 'AVCBin', 'AVCE00', 'AeronavFAA', 'AmigoCloud', 'BNA', 'CAD', 'CSV', 'CSW', 'Carto', 'Cloudant', 'CouchDB', 'DGN', 'DXF', 'EDIGEO', 'ESRI Shapefile', 'ESRIJSON', 'ElasticSearch', 'GFT', 'GML', 'GMLAS', 'GPKG', 'GPSBabel', 'GPSTrackMaker', 'GPX', 'GeoJSON', 'GeoRSS', 'Geoconcept', 'HTF', 'HTTP', 'Idrisi', 'Interlis 1', 'Interlis 2', 'JML', 'JP2OpenJPEG', 'KML', 'LIBKML', 'MBTiles', 'MVT', 'MapInfo File', 'Memory', 'NAS', 'ODS', 'OGR_DODS', 'OGR_GMT', 'OGR_PDS', 'OGR_SDTS', 'OGR_VRT', 'OSM', 'OpenAir', 'OpenFileGDB', 'PCIDSK', 'PDF', 'PGDUMP', 'PLSCENES', 'PostgreSQL', 'REC', 'S57', 'SEGUKOOA', 'SEGY', 'SQLite', 'SUA', 'SVG', 'SXF', 'Selafin', 'TIGER', 'TopoJSON', 'UK .NTF', 'VDV', 'VFK', 'WAsP', 'WFS', 'WFS3', 'XLS', 'XLSX', 'XPlane', 'netCDF']

However, OCI can be used in command line with ogr2ogr and it is listed when executing ogrinfo --formats:
  OCI -vector- (rw+): Oracle Spatial

My environment is as follows:
RHOL 7, GDAL 2.3.3, Python 3.6 (with Numpy 1.16.1), Oracle Instant Client 18.5

I have tried building the python bindings using the following alternatives:
1) Building the python bindings with the GDAL source tree:
./configure --prefix=<GDAL_PREFIX> --with-curl=/usr/bin/curl-config --with-python=<PYTHON3.6_BIN>/python  --with-oci-include=$ORACLE_HOME/sdk/include --with-oci=$ORACLE_HOME
2) Downloading the python bindings from https://pypi.org/project/GDAL/2.3.3/#files and running setup.py build/install process
3) Using pip install GDAL==2.3.3

The result is the same always, I can use the GDAL/OGR python API but cannot see or use the OCI driver (the same for GeoRaster).

As suggested at https://trac.osgeo.org/gdal/wiki/BuildingOnUnix#OCIwithoutinstallingOracle, I have my ORACLE_HOME variable pointing to the instantclient folder, ORACLE_HOME is also present at the PATH and LD_LIBRARY_PATH env vars as it is GDAL/bin and GDAL/lib respectively.

I wonder if I'm missing something.

Any help is appreciated.


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with GDAL/OGR Python API and OCI

Even Rouault-2
On lundi 25 mars 2019 17:26:17 CET Alejandro Saucedo wrote:

> Hello,
> Please, your help with the following problem.
> I am not able to see the Oracle OCI driver from python using the GDAL/OGR
> bindings.
> The following code prints always None:
>     from osgeo import ogr
>     print(ogr.GetDriverByName( 'OCI' ))
>  Also, the driver is never listed here:
>     drivers = [ogr.GetDriver(i).GetDescription() for i in
> range(ogr.GetDriverCount())]
>     drivers.sort()
>     print(drivers)
> ['ARCGEN', 'AVCBin', 'AVCE00', 'AeronavFAA', 'AmigoCloud', 'BNA', 'CAD',
> 'CSV', 'CSW', 'Carto', 'Cloudant', 'CouchDB', 'DGN', 'DXF', 'EDIGEO', 'ESRI
> Shapefile', 'ESRIJSON', 'ElasticSearch', 'GFT', 'GML', 'GMLAS', 'GPKG',
> 'GPSBabel', 'GPSTrackMaker', 'GPX', 'GeoJSON', 'GeoRSS', 'Geoconcept',
> 'HTF', 'HTTP', 'Idrisi', 'Interlis 1', 'Interlis 2', 'JML', 'JP2OpenJPEG',
> 'KML', 'LIBKML', 'MBTiles', 'MVT', 'MapInfo File', 'Memory', 'NAS', 'ODS',
> 'OGR_DODS', 'OGR_GMT', 'OGR_PDS', 'OGR_SDTS', 'OGR_VRT', 'OSM', 'OpenAir',
> 'OpenFileGDB', 'PCIDSK', 'PDF', 'PGDUMP', 'PLSCENES', 'PostgreSQL', 'REC',
> 'S57', 'SEGUKOOA', 'SEGY', 'SQLite', 'SUA', 'SVG', 'SXF', 'Selafin',
> 'TIGER', 'TopoJSON', 'UK .NTF', 'VDV', 'VFK', 'WAsP', 'WFS', 'WFS3', 'XLS',
> 'XLSX', 'XPlane', 'netCDF']
>
> However, OCI can be used in command line with ogr2ogr and it is listed when
> executing ogrinfo --formats:
>   OCI -vector- (rw+): Oracle Spatial
>
> My environment is as follows:
> RHOL 7, GDAL 2.3.3, Python 3.6 (with Numpy 1.16.1), Oracle Instant Client
> 18.5
>
> I have tried building the python bindings using the following alternatives:
> 1) Building the python bindings with the GDAL source tree:
> ./configure --prefix=<GDAL_PREFIX> --with-curl=/usr/bin/curl-config
> --with-python=<PYTHON3.6_BIN>/python
> --with-oci-include=$ORACLE_HOME/sdk/include --with-oci=$ORACLE_HOME
> 2) Downloading the python bindings from
> https://pypi.org/project/GDAL/2.3.3/#files and running setup.py
> build/install process
> 3) Using pip install GDAL==2.3.3
>
> The result is the same always, I can use the GDAL/OGR python API but cannot
> see or use the OCI driver (the same for GeoRaster).
>
> As suggested at
> https://trac.osgeo.org/gdal/wiki/BuildingOnUnix#OCIwithoutinstallingOracle,
> I have my ORACLE_HOME variable pointing to the instantclient folder,
> ORACLE_HOME is also present at the PATH and LD_LIBRARY_PATH env vars as it
> is GDAL/bin and GDAL/lib respectively.

I presume the shared libraries of the python bindings link to another version
of the GDAL lib than the one that you've built.
Locate _gdal.cpython-36m-x86_64-linux-gnu.so (or something like that), and run
ldd on it to see to which libgdal it links to


--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with GDAL/OGR Python API and OCI

Alejandro Saucedo
Yes, it was that. I replaced the library it was linked to with the one from my GDAL I built.

Thank you very much!

Regards.

On Mon, Mar 25, 2019 at 5:56 PM Even Rouault <[hidden email]> wrote:
On lundi 25 mars 2019 17:26:17 CET Alejandro Saucedo wrote:
> Hello,
> Please, your help with the following problem.
> I am not able to see the Oracle OCI driver from python using the GDAL/OGR
> bindings.
> The following code prints always None:
>     from osgeo import ogr
>     print(ogr.GetDriverByName( 'OCI' ))
>  Also, the driver is never listed here:
>     drivers = [ogr.GetDriver(i).GetDescription() for i in
> range(ogr.GetDriverCount())]
>     drivers.sort()
>     print(drivers)
> ['ARCGEN', 'AVCBin', 'AVCE00', 'AeronavFAA', 'AmigoCloud', 'BNA', 'CAD',
> 'CSV', 'CSW', 'Carto', 'Cloudant', 'CouchDB', 'DGN', 'DXF', 'EDIGEO', 'ESRI
> Shapefile', 'ESRIJSON', 'ElasticSearch', 'GFT', 'GML', 'GMLAS', 'GPKG',
> 'GPSBabel', 'GPSTrackMaker', 'GPX', 'GeoJSON', 'GeoRSS', 'Geoconcept',
> 'HTF', 'HTTP', 'Idrisi', 'Interlis 1', 'Interlis 2', 'JML', 'JP2OpenJPEG',
> 'KML', 'LIBKML', 'MBTiles', 'MVT', 'MapInfo File', 'Memory', 'NAS', 'ODS',
> 'OGR_DODS', 'OGR_GMT', 'OGR_PDS', 'OGR_SDTS', 'OGR_VRT', 'OSM', 'OpenAir',
> 'OpenFileGDB', 'PCIDSK', 'PDF', 'PGDUMP', 'PLSCENES', 'PostgreSQL', 'REC',
> 'S57', 'SEGUKOOA', 'SEGY', 'SQLite', 'SUA', 'SVG', 'SXF', 'Selafin',
> 'TIGER', 'TopoJSON', 'UK .NTF', 'VDV', 'VFK', 'WAsP', 'WFS', 'WFS3', 'XLS',
> 'XLSX', 'XPlane', 'netCDF']
>
> However, OCI can be used in command line with ogr2ogr and it is listed when
> executing ogrinfo --formats:
>   OCI -vector- (rw+): Oracle Spatial
>
> My environment is as follows:
> RHOL 7, GDAL 2.3.3, Python 3.6 (with Numpy 1.16.1), Oracle Instant Client
> 18.5
>
> I have tried building the python bindings using the following alternatives:
> 1) Building the python bindings with the GDAL source tree:
> ./configure --prefix=<GDAL_PREFIX> --with-curl=/usr/bin/curl-config
> --with-python=<PYTHON3.6_BIN>/python
> --with-oci-include=$ORACLE_HOME/sdk/include --with-oci=$ORACLE_HOME
> 2) Downloading the python bindings from
> https://pypi.org/project/GDAL/2.3.3/#files and running setup.py
> build/install process
> 3) Using pip install GDAL==2.3.3
>
> The result is the same always, I can use the GDAL/OGR python API but cannot
> see or use the OCI driver (the same for GeoRaster).
>
> As suggested at
> https://trac.osgeo.org/gdal/wiki/BuildingOnUnix#OCIwithoutinstallingOracle,
> I have my ORACLE_HOME variable pointing to the instantclient folder,
> ORACLE_HOME is also present at the PATH and LD_LIBRARY_PATH env vars as it
> is GDAL/bin and GDAL/lib respectively.

I presume the shared libraries of the python bindings link to another version
of the GDAL lib than the one that you've built.
Locate _gdal.cpython-36m-x86_64-linux-gnu.so (or something like that), and run
ldd on it to see to which libgdal it links to


--
Spatialys - Geospatial professional services
http://www.spatialys.com

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev