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

pkg_resources Deprecation Warnings on import #20077

Closed
LucaBonfiglioli opened this issue Jul 12, 2024 · 2 comments · Fixed by #20081
Closed

pkg_resources Deprecation Warnings on import #20077

LucaBonfiglioli opened this issue Jul 12, 2024 · 2 comments · Fixed by #20081
Labels
bug Something isn't working duplicate This issue or pull request already exists help wanted Open to be worked on package ver: 2.2.x
Milestone

Comments

@LucaBonfiglioli
Copy link

Bug description

When using setuptools>=67 importing stuff from pytorch lightning results in deprecation warning.

Setuptools 66.1.1 was released in Jan 20 2023. Pytorch Lightning has been using deprecated pkg_resources APIs for about 18 months. Is there any chance we can get rid of this in one of the next updates?

Thank you :)

What version are you seeing the problem on?

master

How to reproduce the bug

import warnings

warnings.filterwarnings("error")
import pytorch_lightning

Error messages and logs

Traceback (most recent call last):
  File "/home/xxx/repos/xxx/xxx.py", line 4, in <module>
    import lightning_utilities.core.imports
  File "/home/xxx/venvs/xxx/lib/python3.10/site-packages/lightning_utilities/__init__.py", line 6, in <module>
    from lightning_utilities.core.apply_func import apply_to_collection
  File "/home/xxx/venvs/xxx/lib/python3.10/site-packages/lightning_utilities/core/__init__.py", line 5, in <module>
    from lightning_utilities.core.imports import compare_version, module_available
  File "/home/xxx/venvs/xxx/lib/python3.10/site-packages/lightning_utilities/core/imports.py", line 14, in <module>
    import pkg_resources
  File "/home/xxx/venvs/xxx/lib/python3.10/site-packages/pkg_resources/__init__.py", line 105, in <module>
    warnings.warn(
DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

Environment

Current environment
#- PyTorch Lightning Version 2.3.3:
#- PyTorch Version 2.3.1:
#- Python version 3.10:
#- OS (e.g., Linux): Ubuntu 22.04
#- CUDA/cuDNN version: 11.8
#- GPU models and configuration: irrelevant
#- How you installed Lightning(`conda`, `pip`, source): pip

More info

No response

@LucaBonfiglioli LucaBonfiglioli added bug Something isn't working needs triage Waiting to be triaged by maintainers labels Jul 12, 2024
@awaelchli
Copy link
Member

Hey @LucaBonfiglioli
The deprecation does not originate from PyTorch Lightning. You can see in the trace that it is from lightning_utilities. We should fix it there. There is already an issue for it with some discussion: Lightning-AI/utilities#119.

@awaelchli awaelchli added help wanted Open to be worked on duplicate This issue or pull request already exists package and removed needs triage Waiting to be triaged by maintainers labels Jul 12, 2024
@awaelchli awaelchli added this to the 2.4 milestone Jul 15, 2024
@LucaBonfiglioli
Copy link
Author

Thank you for your response. Sorry for the dupliate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists help wanted Open to be worked on package ver: 2.2.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants