I recently cloned arcgispro-py3 env so that that i can use geopandas and arcpy together to output geodataframe to featureclass. To do that, I first export GPKG and then copy over the layer to GDB. It seems that I cannot export to GPKG because geopandas.to_file() depends on fiona, and fiona checks for gdal version. gdal that comes with the cloned env is version "3.7.0e" which throws an error exception because that version cannot be parsed using the regex pattern set in version.py. I believe the string has to be gdal.__version__ == '3.7.0'.
these are the libs and versions that i am working with:
geopandas = '0.12.2'
fiona = '1.8.21'
gdal = '3.7.0e'
arcpy = '3.2'
Here is the error output:
Cell In[11], line 32
27 from arcpy import conversion
28 """Converts a geopandas dataframe to a geopackge layer, converts
29 the geopackage layer to a new feature class in a gdb using arcpy.
30 Returns path to new feature class."""
---> 32 in_gdf.to_file("temp_package.gpkg", layer="temp_package_layer", driver="GPKG")
33 gpkg_layerpath = os.path.join(os.getcwd(), 'temp_package.gpkg\main.temp_geopackage_layer')
34 conversion.FeatureClassToFeatureClass(gpkg_layerpath, out_gdb, out_layer)
File c:\Program Files\ArcGIS\Pro\bin\Python\envs\OpenArcpy\lib\site-packages\geopandas\geodataframe.py:1203, in GeoDataFrame.to_file(self, filename, driver, schema, index, **kwargs)
1120 """Write the ``GeoDataFrame`` to a file.
1121
1122 By default, an ESRI shapefile is written, but any OGR data source
(...)
1199 >>> gdf.to_file('dataframe.shp', mode="a") # doctest: +SKIP
1200 """
1201 from geopandas.io.file import _to_file
-> 1203 _to_file(self, filename, driver, schema, index, **kwargs)
File c:\Program Files\ArcGIS\Pro\bin\Python\envs\OpenArcpy\lib\site-packages\geopandas\io\file.py:545, in _to_file(df, filename, driver, schema, index, mode, crs, engine, **kwargs)
538 warnings.warn(
539 "Column names longer than 10 characters will be truncated when saved to "
540 "ESRI Shapefile.",
541 stacklevel=3,
542 )
544 if engine == "fiona":
--> 545 _to_file_fiona(df, filename, driver, schema, crs, mode, **kwargs)
546 elif engine == "pyogrio":
547 _to_file_pyogrio(df, filename, driver, schema, crs, mode, **kwargs)
File c:\Program Files\ArcGIS\Pro\bin\Python\envs\OpenArcpy\lib\site-packages\geopandas\io\file.py:568, in _to_file_fiona(df, filename, driver, schema, crs, mode, **kwargs)
566 except AttributeError:
567 gdal_version = "2.0.0" # just assume it is not the latest
--> 568 if Version(gdal_version) >= Version("3.0.0") and crs:
569 crs_wkt = crs.to_wkt()
570 elif crs:
File c:\Program Files\ArcGIS\Pro\bin\Python\envs\OpenArcpy\lib\site-packages\packaging\version.py:200, in Version.__init__(self, version)
198 match = self._regex.search(version)
199 if not match:
--> 200 raise InvalidVersion(f"Invalid version: '{version}'")
202 # Store the parsed out pieces of the version
203 self._version = _Version(
204 epoch=int(match.group("epoch")) if match.group("epoch") else 0,
205 release=tuple(int(i) for i in match.group("release").split(".")),
(...)
211 local=_parse_local_version(match.group("local")),
212 )
InvalidVersion: Invalid version: '3.7.0e'