Skip to content

Error installing from the main branch with Python 3.14: AttributeError: module 'pkgutil' has no attribute 'get_loader' #3463

@vandalt

Description

@vandalt

As the title says, I cannot install astroquery from the main branch (locally or with pip pointing to the git URL) on Python 3.14. This is due to pkgutil.get_loader() being deprecated. It is no longer shown in the latest docs and marked as deprecated in the 3.12 docs saying it should be replaced with importlib.util.find_spec. From what I understand, pkgutil.get_loader(name) should become importlib.util.find_spec(name).loader.

The error seems to come from astropy_helpers, but it is used as a git submodule pointing to a different branch and the docs say it is deprecated, so I figured here would be the best place to open an issue.

Click for full error message
Traceback (most recent call last):
        File "/home/vandal/repos/astro/astroquery/venv14/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "/home/vandal/repos/astro/astroquery/venv14/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/vandal/repos/astro/astroquery/venv14/lib64/python3.14/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-8hpu92ie/overlay/lib/python3.14/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-8hpu92ie/overlay/lib/python3.14/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/tmp/pip-build-env-8hpu92ie/overlay/lib/python3.14/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 24, in <module>
        File "/home/vandal/repos/astro/astroquery/astropy_helpers/astropy_helpers/setup_helpers.py", line 90, in setup
          version = generate_version_py()
        File "/home/vandal/repos/astro/astroquery/astropy_helpers/astropy_helpers/version_helpers.py", line 343, in generate_version_py
          f.write(_get_version_py_str(packagename, version, last_githash,
                  ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                      release, debug, uses_git=uses_git))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/vandal/repos/astro/astroquery/astropy_helpers/astropy_helpers/version_helpers.py", line 157, in _get_version_py_str
          header = _generate_git_header(packagename, version, githash)
        File "/home/vandal/repos/astro/astroquery/astropy_helpers/astropy_helpers/version_helpers.py", line 189, in _generate_git_header
          loader = pkgutil.get_loader(git_helpers)
                   ^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'get_loader'
      [end of output]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions