The 'schema' argument is not supported with the 'pyogrio' engine

I just updated to Python 3.12.3 …

fig.plot is now tripping up when working with Pandas geodataframes (gdf). It’s very odd … right before the fig.plot(gdf), the dataframe looks normal:
image

and right after (i.e., after the schema argument fail), the gfd looks different:
image

It’s as though fig.plot is changing the input geodataframe structure.

PyGMT information:
version: v0.12.0
System information:
python: 3.12.3 | packaged by conda-forge | (main, Apr 15 2024, 18:20:11) [MSC v.1938 64 bit (AMD64)]
machine: Windows-11-10.0.22631-SP0
Dependency information:
numpy: 1.26.4
pandas: 2.2.2
xarray: 2024.6.0
netCDF4: 1.6.5
packaging: 24.1
contextily: 1.6.0
geopandas: 1.0.1
ipython: None
rioxarray: 0.15.7
ghostscript: 10.03.1
GMT library information:
binary version: 6.5.0
cores: 12
grid layout: rows
image layout:
padding: 2
version: 6.5.0

1 Like

Ah yes, we’re facing some issues with geopandas=1.0.0 and the new default ‘pyogrio’ engine, @seisman has a bug report at geopandas 1.0.0 or pyogrio 0.9.0 doesn't support OGR_GMT output? · Issue #3301 · GenericMappingTools/pygmt · GitHub.

Could you also provide us with the GDAL version (from conda list) you have installed? Is it GDAL 3.8 or 3.9?

1 Like

Thanks @weiji14 – here’s the info:
gdal 3.9.0 py312h7090a6d_5 conda-forge

Oh wait, I got confused with the actual issue. We’ve actually fixed this ValueError: The 'schema' argument is not supported with the 'pyogrio' engine problem already in geopandas: Use io.StringIO to read geojson data and handle compatibility with geopandas v0.x and v1.x by seisman · Pull Request #3247 · GenericMappingTools/pygmt · GitHub, but that will come in the next PyGMT release (v0.13.0), probably not until next month at the earliest.

If you can’t wait and don’t mind installing a beta version with the bugfix applied, you can try to upgrade PyGMT in your conda environment:

python -m pip install --pre --extra-index-url https://test.pypi.org/simple/ pygmt

Let us know if that works.

Unfortunatly it didn’t work for me :frowning_face:. I haven’t been able to run the roads example: Roads — PyGMT

Got:

ValueError: The 'schema' argument is not supported with the 'pyogrio' engine.

Hmm, @emetdan, to help us debug, can you provide the output of running:

import pygmt

pygmt.show_versions()

Hello, I’ve just run into the same issue as well. The exception above ("the ‘schema’ argument is not supported with the ‘pyogiro’ engine) occurs when I try to plot a geopandas GeoDataFrame with polygon features.

PyGMT information:
version: v0.11.0
System information:
python: 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:42:31) [MSC v.1937 64 bit (AMD64)]
executable:
machine: Windows-10
Dependency information:
numpy: 1.26.4
pandas: 2.2.2
xarray: 2023.6.0
netCDF4: 1.6.5
packaging: 23.2
contextily: 1.6.0
geopandas: 1.0.0
ipython: None
rioxarray: 0.15.7
ghostscript: 10.03.0
GMT library information:
binary version: 6.4.0
cores: 16
grid layout: rows
image layout:
library path:
padding: 2
plugin dir:
share dir:
version: 6.4.0

Thanks for providing the version info @momara, did you try if installing the beta version of PyGMT (mentioned above at The 'schema' argument is not supported with the 'pyogrio' engine - #4 by weiji14), to see if it resolves the pyogrio error? I.e.

conda activate <name-of-your-conda-env>
python -m pip install --pre --extra-index-url https://test.pypi.org/simple/ pygmt
python -c "import pygmt; pygmt.show_versions()"

If the installation is successful, you should see a PyGMT version like v0.12.1.dev90+g3a62fc1b1.d20240609 (the devXX part may vary a bit).

1 Like

Thank you. I think the Beta version installment did not work (everything was “already satisfied”, see below) … which may mean I’m waiting for the 0.13 release. Could you advise @weiji14 ?

(TAK_3_12_4) C:\Users\TrK>python -m pip install --pre --extra-index-url https://test.pypi.org/simple/ pygmt
Looking in indexes: https://pypi.org/simple, https://test.pypi.org/simple/
Requirement already satisfied: pygmt in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (0.12.0)
Requirement already satisfied: numpy>=1.23 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (1.26.4)
Requirement already satisfied: pandas>=1.5 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (2.2.2)
Requirement already satisfied: xarray>=2022.06 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (2024.6.0)
Requirement already satisfied: netCDF4 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (1.6.5)
Requirement already satisfied: packaging in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (24.1)
Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pandas>=1.5->pygmt) (2.9.0)
Requirement already satisfied: pytz>=2020.1 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pandas>=1.5->pygmt) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pandas>=1.5->pygmt) (2024.1)
Requirement already satisfied: cftime in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from netCDF4->pygmt) (1.6.4)
Requirement already satisfied: certifi in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from netCDF4->pygmt) (2024.6.2)
Requirement already satisfied: six>=1.5 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from python-dateutil>=2.8.2->pandas>=1.5->pygmt) (1.16.0)

(TAK_3_12_4) C:\Users\TrK>python -c "import pygmt; pygmt.show_versions()"
PyGMT information:
  version: v0.12.0

Try add the -U flag to pip:

python -m pip install -U --pre --extra-index-url https://test.pypi.org/simple/ pygmt
2 Likes

Thanks @seisman – that installation worked:

(TAK_3_12_4) C:\Users\TrK>python -m pip install -U --pre --extra-index-url https://test.pypi.org/simple/ pygmt
Looking in indexes: https://pypi.org/simple, https://test.pypi.org/simple/
Requirement already satisfied: pygmt in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (0.12.0)
Collecting pygmt
  Downloading https://test-files.pythonhosted.org/packages/6e/aa/f9368edc3c1bdc3029e0c911f2758ad7e73457dfa55622de1365eb9d669f/pygmt-0.12.1.dev81-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: numpy>=1.24 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (1.26.4)
Requirement already satisfied: pandas>=1.5 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (2.2.2)
Requirement already satisfied: xarray>=2022.06 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (2024.6.0)
Requirement already satisfied: netCDF4 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (1.6.5)
Requirement already satisfied: packaging in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pygmt) (24.1)
Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pandas>=1.5->pygmt) (2.9.0)
Requirement already satisfied: pytz>=2020.1 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pandas>=1.5->pygmt) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from pandas>=1.5->pygmt) (2024.1)
Requirement already satisfied: cftime in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from netCDF4->pygmt) (1.6.4)
Requirement already satisfied: certifi in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from netCDF4->pygmt) (2024.6.2)
Requirement already satisfied: six>=1.5 in c:\users\trk\anaconda3\envs\tak_3_12_4\lib\site-packages (from python-dateutil>=2.8.2->pandas>=1.5->pygmt) (1.16.0)
Downloading https://test-files.pythonhosted.org/packages/6e/aa/f9368edc3c1bdc3029e0c911f2758ad7e73457dfa55622de1365eb9d669f/pygmt-0.12.1.dev81-py3-none-any.whl (263 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 263.7/263.7 kB 2.3 MB/s eta 0:00:00
Installing collected packages: pygmt
  Attempting uninstall: pygmt
    Found existing installation: pygmt 0.12.0
    Uninstalling pygmt-0.12.0:
      Successfully uninstalled pygmt-0.12.0
Successfully installed pygmt-0.12.1.dev81

However, I get a “new” error with fig.plot():

DataSourceError: Could not obtain driver: OGR_GMT (check that it was installed correctly into GDAL)

That’s another issue we’re having. See geopandas 1.0.0 or pyogrio 0.9.0 doesn't support OGR_GMT output? · Issue #3301 · GenericMappingTools/pygmt · GitHub for a temporary workaround.

1 Like