Skip to content

DeprecationWarning: pkg_resources is deprecated as an API in utils/module.py #7559

Closed
@joshuacwnewton

Description

@joshuacwnewton

The following warning has appeared in our pytest output:

=============================== warnings summary ===============================
python/envs/venv_sct/lib/python3.9/site-packages/monai/utils/module.py:396
  /home/runner/work/spinalcordtoolbox/spinalcordtoolbox/python/envs/venv_sct/lib/python3.9/site-packages/monai/utils/module.py:396:"""
DeprecationWarning: pkg_resources is deprecated as an API. 
See https://setuptools.pypa.io/en/latest/pkg_resources.html
    pkg = __import__(module)  # top level module
"""

MONAI version: 1.3.0

Skimming the MONAI source code, it seems like MONAI made this an optional import in #2482:

pkging, has_ver = optional_import("pkg_resources", name="packaging")

But, it seems like pkg_resources shouldn't be used at all: https://setuptools.pypa.io/en/latest/pkg_resources.html

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