-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Fix distutils.LooseVersion DeprecationWarning #88524
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/88524
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 0dd19a1: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@milutter, I tried opening this PR based on the diff from your comment on issue #84712.
(here's an example CI job failure: https://github.com/pytorch/pytorch/actions/runs/3397514945/jobs/5649878533#step:10:3456) |
the module Simply from packaging import version
...
if not hasattr(tensorboard, "__version__") or version.parse(
tensorboard.__version__
) < version.Version("1.15"):
... could fix this. |
Thanks @MaKaNu! I've updated the PR based on your comments. |
Thanks everybody for the effort! The explicit import of Can we try adding it to the requirements? It's a bit hard to debug without knowing specifically why is running where. |
Thanks for the tip, @milutter! I've added |
@milutter I wondered what may caused the necessity to explicit import module 'packaging' has not attribute 'version' but which module is meant? Packaging is a package which next to other modules the If we instead call |
Thanks @MaKaNu for the explanation. I looked a bit deeper into resolving the problem. I still believe this is a requirements problem such that MYPY does not find the types stubs. Adding it to To get it past the
|
Hopefully we can get eyes on this PR from someone who knows how the lints work. |
I ran a small test env and used the package as torch used it. Worked fine and ran mypy manuall over it -> No Errors. I am not completly sure about it, but I will find it again, but this might be a wrong configured mypy setup: I don't have the link at the moment, but will search it, but I have read about stubs and things for builtin packages. If stubs are absolutley necessary aswell for builtin, we need to add them. Stay tuned for further informations tomorrow. |
I looked into it again and found the conversations, but I do not understand completely: python/mypy#638. On the other hand I found another issue python/mypy#4542, which is pointing to the issue, which also mention PEP 561 as a solution. I did not had the time to dig deeper into this, but this might help to find the issue. |
I looked at the links from @MaKaNu and they seem to be related. The different search path between python and MyPy seem like a big mess. Even when reading the complete posts, I do not fully understand the problem or see a possible solution. From other blogpost, I have seen two hacks that might mitigate the problem (https://stackoverflow.com/questions/68695851/mypy-cannot-find-implementation-or-library-stub-for-module):
@Jasha10 Would you be able to try these different solutions? |
Looks like the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for trying and fixing it. I am happy to get this finally resolved.
Do you know the process of actually merging this PR? Does somebody within PyTorch need to approve & merge the PR. How does one get their attention for this?
I don't know but hope, that now as every checks have passed an authorized user get informed about it. At the end I still wonder why mypy even has a problem with the builtin lib. I think something is not correctly configured for mypy, since a non configured mypy install does not react on this. |
@@ -1,12 +1,12 @@ | |||
import tensorboard | |||
from distutils.version import LooseVersion | |||
from packaging import version # type: ignore[import] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still think the ignore solves the mypy issue but should not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why I have looked into, but there are actually 3 mypy.ini
configs. I understand why we use mypy.ini
and mypy-strict.ini
. But the uncommented mypy-nofollow.ini
? From the commit message I got a hint.
Which of them is used in this pipeline? I don't know but it should be the normal mypy.ini
or mypy-nofollow.ini
but not the strict one.
It might be the mypy-nofollow.ini
since there are less ignore_missing_imports = True
.
FYI @MaKaNu, $ python -q
>>> import packaging
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'packaging' |
this is weird and you are right. Somehow on my wsl installation packaging is installed without environment. |
@Jasha10 I just saw that you are part of the PyTorch organization, would you be able to get some movement into this PR, such that it is reviewed and accepted? |
@milutter I'm honored to be a part of the pytorch org, but TBH I don't know why I'm part of the pytorch org. (I was added to it randomly 🤷🏼) |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: This PR is too stale; the last push date was more than 3 days ago. Please rebase and try again. You can rebase by leaving the following comment on this PR: Details for Dev Infra teamRaised by workflow job |
@pytorchbot rebase |
You don't have permissions to rebase this PR, only people with write permissions may rebase PRs. |
Successfully rebased |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
eh, I just realized I can't merge this, as Can we use something that doesn't add a dependency? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be using packaging
The merge job was canceled. If you believe this is a mistake,then you can re trigger it through pytorch-bot. |
we could add |
We can parse the version number by hand: >>> import tensorboard
>>> tuple(map(int, tensorboard.__version__.split(".")))
(2, 11, 0) The advantage of |
thanks @soumith for taking a look at this and trying to merge the PR! I would prefer to add What seems weird to me that the tests are passing when packaging is not a dependency? Nevertheless, where are the python dependencies listed in pytorch? I looked into the classical Older CI Failure:
|
you should add The reason CI passes is because the CI is pre-populated with a bunch of packages (for a variety of reasons) |
Done! |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
thanks for the fix @Jasha10 ! |
This pull request has been reverted by cce577b. To re-land this change, please open another pull request, assignthe same reviewers, fix the CI failures that caused the revert and make sure that the failing CI runs on the PR by applying the proper ciflow label (e.g., ciflow/trunk). |
@weiwangmeta: This PR got reverted by your PR #91548. All the test failures link to internal meta resources, which make it hard to debug. Could you copy the test failure error message to investigate the failure? |
yea the failures are around having to adjust internal build files. one of us will have to take it on. Can you reopen the PR |
actually, looks like @Jasha10 is at Meta. Jascha, you can open this PR as a diff in FBCode and add |
@soumith I am no longer at Meta. Sorry I couldn't get to this while I was still there. |
Fixes #84712