geopandas: Writing GPKG file failing on Windows

From https://github.com/geopandas/geopandas/pull/870#issuecomment-484003547

Currently, the tests for GPKG writing on Appveyor + Python 2.7 are skipped. The error we see is (https://ci.appveyor.com/project/jorisvandenbossche/geopandas-us6w0/builds/23408016/job/v7g468n7dml8t43v):

____ TestGeoDataFrameToFile.test_geodataframe_to_file[geodataframe0-GPKG] _____
self = <geopandas.tests.test_geodataframe_to_file.TestGeoDataFrameToFile instance at 0x000000000E29C288>
geodataframe =    a                              geometry
0  1  POINT (-73.55378500000001 45.508722)
1  2           POINT (-73.554138 45.50908)
ogr_driver = 'GPKG'
    def test_geodataframe_to_file(self, geodataframe, ogr_driver):
        expected_error = _expected_error_on(geodataframe, ogr_driver, _FIONA18)
        if expected_error:
            with pytest.raises(expected_error.type, match=expected_error.match):
                geodataframe.to_file(self.output_file, driver=ogr_driver)
        else:
>           self._assert_to_file_succeeds(geodataframe, ogr_driver)
geopandas\tests\test_geodataframe_to_file.py:327: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
geopandas\tests\test_geodataframe_to_file.py:330: in _assert_to_file_succeeds
    gdf.to_file(self.output_file, driver=ogr_driver)
geopandas\geodataframe.py:429: in to_file
    to_file(self, filename, driver, schema, **kwargs)
geopandas\io\file.py:123: in to_file
    colxn.writerecords(df.iterfeatures())
C:\Miniconda-x64\envs\test-environment\lib\site-packages\fiona\collection.py:421: in __exit__
    self.close()
C:\Miniconda-x64\envs\test-environment\lib\site-packages\fiona\collection.py:403: in close
    self.flush()
C:\Miniconda-x64\envs\test-environment\lib\site-packages\fiona\collection.py:393: in flush
    self.session.sync(self)
fiona/ogrext.pyx:1085: in fiona.ogrext.WritingSession.sync
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>   ???
E   CPLE_AppDefinedError: sqlite3_exec(CREATE VIRTUAL TABLE "rtree_output_file_geom" USING rtree(id, minx, maxx, miny, maxy)) failed: no such module: rtree
fiona/_err.pyx:185: CPLE_AppDefinedError
------------------------------ Captured log call ------------------------------
collection.py              156 WARNING  CPLE_AppDefined in The '' extension is not allowed by the GPKG specification, which may cause compatibility problems
collection.py              156 WARNING  CPLE_NotSupported in dataset c:\users\appveyor\appdata\local\temp\1\tmpxzg1ww\output_file does not support layer creation option ENCODING
collection.py              393 ERROR    CPLE_AppDefined in sqlite3_exec(CREATE VIRTUAL TABLE "rtree_output_file_geom" USING rtree(id, minx, maxx, miny, maxy)) failed: no such module: rtree

So it gives an error indicating that sqlite was not properly build with rtree enabled. However, this should be the case since https://github.com/conda-forge/sqlite-feedstock/pull/20

@ljwolf noted here https://github.com/geopandas/geopandas/pull/870#issuecomment-484003547 that there might be a mistake in the bld script.

@ocefpaf @snorfalorpagus should maybe also open an issue on the sqlite feedstock?

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 22 (13 by maintainers)

Most upvoted comments

For me (still on windows), I can write a gpkg but I still get an error that the rtree module is not available in sqlite. The gpkg created indeed does not have a spatial index, but when needed I add it in QGis.