Skip to content

pkg_resources is deprecated as an API for python 3.13.5 #8536

Closed

Description

@mgraugal

When installing monai and importing in python 3.13.5, we get a deprecation warning:

Python 3.13.5 (main, Jul 28 2025, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.

import monai
/data/devspace/marc/game-on-autoptz/venv/lib64/python3.13/site-packages/monai/utils/module.py:399: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
pkg = import(module) # top level module

This would need to be solved in future updates to prevent from breaking

Activity

  1. ericspod commented on Aug 12, 2025

    @ericspod
    Member

    Hi @mgraugal thanks for flagging this. We don't use pkg_resources any more but this might be warned as part of our import process. When this package is removed there shouldn't be a problem and the warning will cease.

  2. self-assigned this
    on Sep 22, 2025
  3. ericspod commented on Feb 13, 2026

    @ericspod
    Member

    The pkg_resouces package has now been removed from PyPI rather than just deprecated, MONAI itself isn't affected but downstream projects are, specifically MetricsReloaded. As a result installing these packages through pip fails with an error about the package not being found.

    The solution used with MONAI is to ensure a working version of setuptools is installed in an environment, then use the pip --no-build-isolation option to force building in that environment when installing requirements. This avoids subsequent build operations installing a newer version which has this issue. This has been done in #8738 by @KumoLiu and other PRs to update the tutorials and model zoo repos are in progress. We do need to update MetricsReloaded however to eliminate the need for this fix (CC @csudre).

  4. moved this to In Progress in MONAI v1.6on Feb 13, 2026
  5. added theissue type on Feb 13, 2026
  6. ericspod commented on Feb 13, 2026

    @ericspod
    Member

    Related issue: pypa/setuptools#5174

  7. moved this to 🏗 In Progress in MONAI Core Backlogon Jun 23, 2026
  8. moved this from In Progress to Done in MONAI v1.6on Sep 2, 2026
  9. moved this from 🏗 In Progress to ✅ Done in MONAI Core Backlogon Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

github_actionsPull requests that update GitHub Actions code

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions