Skip to content

AttributeError when running pygmt.show_versions() #4335

@willschlitzer

Description

@willschlitzer

Description of the problem

When trying to run the system information command python -c "import pygmt; pygmt.show_versions()", I receive an AttributeError, specifically for pd.DataFrame.

  File "/home/will/Desktop/repos/pygmt/pygmt/_typing.py", line 25, in <module>
    TableLike = dict | np.ndarray | pd.DataFrame | xr.Dataset
                                    ^^^^^^^^^^^^
AttributeError: partially initialized module 'pandas' from '/envs/pygmt/lib/python3.14/site-packages/pandas/__init__.py' has no attribute 'DataFrame' (most likely due to a circular import)

Not sure why I would be receiving this. It looks like I have up-to-date pandas packages.

pandas                         2.3.3                                                                                                                                                                              
pandas-stubs                   2.3.3.251219                                                                                                                                                                       
pandocfilters                  1.5.0 

Minimal Complete Verifiable Example

python -c "import pygmt; pygmt.show_versions()"

Full error message

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import pygmt; pygmt.show_versions()
    ^^^^^^^^^^^^
  File "/home/will/Desktop/repos/pygmt/pygmt/__init__.py", line 24, in <module>
    from pygmt import datasets
  File "/home/will/Desktop/repos/pygmt/pygmt/datasets/__init__.py", line 7, in <module>
    from pygmt.datasets.earth_age import load_earth_age
  File "/home/will/Desktop/repos/pygmt/pygmt/datasets/earth_age.py", line 11, in <module>
    import xarray as xr
  File "/envs/pygmt/lib/python3.14/site-packages/xarray/__init__.py", line 3, in <module>
    from xarray import coders, groupers, indexes, testing, tutorial, ufuncs
  File "/envs/pygmt/lib/python3.14/site-packages/xarray/coders.py", line 6, in <module>
    from xarray.coding.times import CFDatetimeCoder, CFTimedeltaCoder
  File "/envs/pygmt/lib/python3.14/site-packages/xarray/coding/times.py", line 12, in <module>
    import pandas as pd
  File "/envs/pygmt/lib/python3.14/site-packages/pandas/__init__.py", line 49, in <module>
    from pandas.core.api import (
    ...<62 lines>...
    )
  File "/envs/pygmt/lib/python3.14/site-packages/pandas/core/api.py", line 1, in <module>
    from pandas._libs import (
    ...<4 lines>...
    )
  File "/envs/pygmt/lib/python3.14/site-packages/pandas/_libs/__init__.py", line 18, in <module>
    from pandas._libs.interval import Interval
  File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
  File "pandas/_libs/hashtable.pyx", line 1, in init pandas._libs.hashtable
  File "pandas/_libs/missing.pyx", line 1, in init pandas._libs.missing
  File "/envs/pygmt/lib/python3.14/site-packages/pandas/_libs/tslibs/__init__.py", line 40, in <module>
    from pandas._libs.tslibs.conversion import localize_pydatetime
  File "pandas/_libs/tslibs/conversion.pyx", line 1, in init pandas._libs.tslibs.conversion
  File "pandas/_libs/tslibs/offsets.pyx", line 1, in init pandas._libs.tslibs.offsets
  File "pandas/_libs/tslibs/timestamps.pyx", line 1, in init pandas._libs.tslibs.timestamps
  File "pandas/_libs/tslibs/timedeltas.pyx", line 86, in init pandas._libs.tslibs.timedeltas
  File "pandas/_libs/tslibs/fields.pyx", line 25, in init pandas._libs.tslibs.fields
  File "/envs/pygmt/lib/python3.14/site-packages/pandas/_config/localization.py", line 12, in <module>
    import subprocess
  File "/envs/pygmt/lib/python3.14/subprocess.py", line 124, in <module>
    import select
  File "/home/will/Desktop/repos/pygmt/pygmt/src/select.py", line 10, in <module>
    from pygmt._typing import PathLike, TableLike
  File "/home/will/Desktop/repos/pygmt/pygmt/_typing.py", line 25, in <module>
    TableLike = dict | np.ndarray | pd.DataFrame | xr.Dataset
                                    ^^^^^^^^^^^^
AttributeError: partially initialized module 'pandas' from '/envs/pygmt/lib/python3.14/site-packages/pandas/__init__.py' has no attribute 'DataFrame' (most likely due to a circular import)

System information

Unable (per issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions