kart-qgis-plugin icon indicating copy to clipboard operation
kart-qgis-plugin copied to clipboard

Can't import dataset from database (GDAL DLL)

Open MaelREBOUX opened this issue 1 year ago • 11 comments

Describe the bug

Really happy to test this famous plugin ! But with a fresh install of QGIS 3.16 and the kart plugin I can initialize a repo but cannot import a layer from a PostGIS database.

Reading the logs I don't know what is wrong. Help wanted...

Voluntary duplicate to #55

To Reproduce

Steps to reproduce the behavior:

  1. right-click on the repository in the kart plugin panel
  2. import dataset from database
  3. fill the connection informations
  4. choose a table / a layer
  5. Import

Then a modal dialog with errors appears :

127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
127: La procédure spécifiée est introuvable.
[22448] Failed to execute script 'kart_cli' due to unhandled exception!
Traceback (most recent call last):
File "kart_cli.py", line 4, in 
File "kart\cli.py", line 392, in entrypoint
File "click\core.py", line 1130, in __call__
File "click\core.py", line 1055, in main
File "kart\cli_util.py", line 68, in invoke
File "click\core.py", line 1657, in invoke
File "click\core.py", line 1404, in invoke
File "click\core.py", line 760, in invoke
File "click\decorators.py", line 26, in new_func
File "kart\tabular\import_.py", line 343, in import_
File "kart\fast_import.py", line 268, in fast_import_tables
File "kart\tabular\pk_generation.py", line 85, in wrap_sources_if_needed
File "kart\tabular\pk_generation.py", line 85, in 
File "kart\tabular\pk_generation.py", line 78, in wrap_source_if_needed
File "kart\tabular\import_source.py", line 156, in schema
File "kart\schema.py", line 274, in from_column_dicts
TypeError: 'NoneType' object is not iterable 

And in the kart panel :

2022-09-16T16:11:39     CRITICAL    ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_ECW_JP2ECW.dll
             127: La procédure spécifiée est introuvable.
             
             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_ECW_JP2ECW.dll
             127: La procédure spécifiée est introuvable.
             
             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_GEOR.dll
             127: La procédure spécifiée est introuvable.
             
             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_GEOR.dll
             127: La procédure spécifiée est introuvable.
             
             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_HDF5.dll
             127: La procédure spécifiée est introuvable.
             
             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_HDF5.dll
             127: La procédure spécifiée est introuvable.
             
             ERROR 1: Can't load requested DLL: C:\PROGRA~1\QGIS\3.16\bin\gdalplugins\gdal_MG4Lidar.dll
             127: La procédure spécifiée est introuvable.
             [Showing only the first 20 lines]

But these plugins are present in the directory

image

Expected behavior To work

Version info (this is important!):

  • Windows 10 10.0.19041
  • QGIS 3.16.8
  • kart plugin 1.0.3
  • kart
Kart v0.11.5, Copyright (c) Kart Contributors
» GDAL v3.3.2; PROJ v8.1.1
» PyGit2 v1.9.0; Libgit2 v1.4.2; Git v2.34.0.windows.1.13.g93318cbc8d
» SQLAlchemy v1.4.40; pysqlite3 v2.6.0/v3.31.1; SpatiaLite v5.0.0; Libpq v11.0.9
» SpatialIndex v1.9.3

MaelREBOUX avatar Sep 16 '22 14:09 MaelREBOUX

Thanks for reporting this.

This looks to be a similar issue to how the GDAL import paths are being set incorrect, I'll confirm if this is the same cause and if a similar fix can sort it out.

pfw avatar Sep 18 '22 23:09 pfw

On my Windows system variables I get :

  • GDAL_DATA = "C:\applications\postgresql\13.8\gdal-data"

And because I have 2 PostgreSQL servers and 2 QGIS installed I get ogr2ogr in 4 places :

  • C:\applications\postgresql\11.9\bin\ogr2ogr.exe -> v2.2.4
  • C:\applications\postgresql\13.8\bin\ogr2ogr.exe -> v3.4.3
  • C:\Program Files\QGIS\3.16\bin\ogr2ogr.exe -> v3.1.4
  • C:\Program Files\QGIS\3.26\bin\ogr2ogr.exe -> v3.5.1

And by the game of the path variable, my current ogr2ogr.exe is the PG 13.8 one.

Hope this will help

MaelREBOUX avatar Sep 19 '22 07:09 MaelREBOUX

Hello any clue to test here on my workstation ?

MaelREBOUX avatar Sep 30 '22 07:09 MaelREBOUX

Nothing immediately, I'm afraid. What did you use to install PostgresQL?

pfw avatar Oct 09 '22 22:10 pfw

Having the same issue, importing from Postgresql gives the following error

image

Installed 14.5 using enterprisedb

https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

antoniolocandro avatar Nov 04 '22 23:11 antoniolocandro

@antoniolocandro Could you double check the 'Import from Database' dialog for me to see that both 'host' and 'port' have values? I am able to recreate this issue when I specify a port, database, table, username and password but not hostname.

pfw avatar Nov 07 '22 08:11 pfw

Hello a colleague succeed to make kart work. There is an issue in the PG connection string that is raised. The int / str errot is linked to that. I have to double check this and I come back here.

MaelREBOUX avatar Nov 07 '22 08:11 MaelREBOUX

@MaelREBOUX Thanks for the update - if it is something similar to my example above where there some parts of the connection info aren't present then that makes sense and I know what we need to sort out there.

pfw avatar Nov 07 '22 08:11 pfw

This is what I input, very similar to what I have in DB manager in QGIS (probably would be better if plugin detected existing connections by default also)

image

Tables are loaded correctly including the corresponding schema but upon selecting one and hitting OK to load the message error pop ups

image

antoniolocandro avatar Nov 07 '22 13:11 antoniolocandro

Thanksk @antoniolocandro that is what I expected, I'll work up a fix for that ASAP but in the meantime if you add localhost as the host in that dialog does it go through correctly?

pfw avatar Nov 07 '22 20:11 pfw

Adding localhost solves the issue, hopefully existing connections would be detected and that would save some time

antoniolocandro avatar Nov 08 '22 01:11 antoniolocandro