Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
joshuacwnewton opened this issue Mar 18, 2024 · 3 comments · Fixed by #7953
Closed

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

joshuacwnewton opened this issue Mar 18, 2024 · 3 comments · Fixed by #7953
Labels

Comments

@joshuacwnewton
Copy link

joshuacwnewton commented Mar 18, 2024

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

joshuacwnewton added a commit to spinalcordtoolbox/spinalcordtoolbox that referenced this issue Mar 18, 2024
I had mistakenly thought this was resolved (because `wandb` did indeed resolve it on their end),
but this is still not resolved for `monai`. I have reported this upstream: Project-MONAI/MONAI#7559
@KumoLiu KumoLiu added enhancement New feature or request Contribution wanted labels Mar 19, 2024
@rukundob451
Copy link

@joshuacwnewton is this issue still available?

@joshuacwnewton
Copy link
Author

joshuacwnewton commented Jul 18, 2024

Yes, I think so, given that there have been no changes to the MONAI codebase to remove the usage of pkg_resources. :)

@ken-ni
Copy link
Contributor

ken-ni commented Jul 19, 2024

I'm with CodeDay Labs 2024, my team is currently working on this.

@KumoLiu KumoLiu closed this as completed in 6be7b13 Aug 9, 2024
rcremese pushed a commit to rcremese/MONAI that referenced this issue Sep 2, 2024
Fixes Project-MONAI#7559 .

### Description  
Replaced "pkg_resources" references with "packaging" in
MONAI/monai/utils/module.py & setup.py
Changes were made in functions "pytorch_after", "version_leq",
"version_geq".

### Types of changes
- Non-breaking change (fix or new feature that would not break existing
functionality).

---------

Signed-off-by: dedeepyasai <[email protected]>
Signed-off-by: saelra <[email protected]>
Signed-off-by: Kelvin R <[email protected]>
Signed-off-by: ken-ni <[email protected]>
Signed-off-by: Dureti <[email protected]>
Signed-off-by: YunLiu <[email protected]>
Co-authored-by: saelra <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: dedeepyasai <[email protected]>
Co-authored-by: YunLiu <[email protected]>
Co-authored-by: Ratanachat Saelee <[email protected]>
Co-authored-by: ken-ni <[email protected]>
Co-authored-by: Dureti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants