-
Notifications
You must be signed in to change notification settings - Fork 1.7k
"ImportError: cannot import name 'Mapping' from 'collections'" with Python 3.10 #5478
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
Comments
Have you tried from collections import Mapping to from collections.abc import Mapping ? and moreover please have a look at similar issue which is described here #69381312. Thanks |
@pindinagesh Yes, as written above I can confirm that using
works around the issue (which is also basically what was introduced in html5lib/html5lib-python#403). Thanks. |
Thanks for the report @simonkrenger , it looks like we will need to make a PR similar to #2549 to upgrade html5lib |
Hrm - looks like we can't upgrade to https://github.com/html5lib/html5lib-python/blob/1.1/CHANGES.rst |
I dunno why the release notes say UNRELEASED but it was definitely released - there's a 1.1 tag on GitHub and it's also on PyPI (https://pypi.org/project/html5lib/1.1/). That said, since we vendor html5lib anyway rather than depending on it, we don't need it to be any particular release - we could use an arbitrary GitHub commit. We just need to update the dependencies here: https://cs.opensource.google/tensorflow/tensorboard/+/master:third_party/python.bzl;l=47-56;drc=c4ad956e4225b2b85330002745cff09f9e06b2f6 We'll probably also need to update third_party/html5lib.BUILD to match the expected set of files. |
@bmd3k This should be a pretty straightforward fix - let's try to get this into the coming release as well? |
Additional note: On master branch it does not have the |
As noted by #5478 , tensorboard fails when run in a python 3.10 environment. The reporter fortunately discovered that the problems would be fixed with an upgrade of our html5lib dependency. I tested by building a python3.10 virtualenv on my machine (this required building python 3.10 from source as we don't have it natively). I also ran the tensorboard with some logdirs and did some basic sanity. I specifically checked that markdown rendering seemed to be working for a couple text plugin logs that I have.
As noted by tensorflow#5478 , tensorboard fails when run in a python 3.10 environment. The reporter fortunately discovered that the problems would be fixed with an upgrade of our html5lib dependency. I tested by building a python3.10 virtualenv on my machine (this required building python 3.10 from source as we don't have it natively). I also ran the tensorboard with some logdirs and did some basic sanity. I specifically checked that markdown rendering seemed to be working for a couple text plugin logs that I have.
As noted by #5478 , tensorboard fails when run in a python 3.10 environment. The reporter fortunately discovered that the problems would be fixed with an upgrade of our html5lib dependency. I tested by building a python3.10 virtualenv on my machine (this required building python 3.10 from source as we don't have it natively). I also ran the tensorboard with some logdirs and did some basic sanity. I specifically checked that markdown rendering seemed to be working for a couple text plugin logs that I have.
tensorboard is currently not compatible with Python 3.10, but will be in the next release (tensorflow/tensorboard#5478).
I was running elasticsearch and elasticsearch-dsl in python3.10. It raises error collections.abs.
|
Friends, the problem is very easy to solve. Delete and reinstall the django you downloaded for your project: |
where to use this? |
@simonkrenger can you tell me where to us this |
See the original description above:
|
i,ve facing this issue too, but i,m used the module requests, and my code show me this error, someone help plz |
This issue should be resolved for recent versions of TensorBoard. If you are not using TensorBoard, please do not comment on this issue, we cannot help with resolving this error for you. |
As noted by tensorflow#5478 , tensorboard fails when run in a python 3.10 environment. The reporter fortunately discovered that the problems would be fixed with an upgrade of our html5lib dependency. I tested by building a python3.10 virtualenv on my machine (this required building python 3.10 from source as we don't have it natively). I also ran the tensorboard with some logdirs and did some basic sanity. I specifically checked that markdown rendering seemed to be working for a couple text plugin logs that I have.
As noted by tensorflow#5478 , tensorboard fails when run in a python 3.10 environment. The reporter fortunately discovered that the problems would be fixed with an upgrade of our html5lib dependency. I tested by building a python3.10 virtualenv on my machine (this required building python 3.10 from source as we don't have it natively). I also ran the tensorboard with some logdirs and did some basic sanity. I specifically checked that markdown rendering seemed to be working for a couple text plugin logs that I have.
Environment information (required)
Diagnostics output
Issue description
When running TensorBoard with Python 3.10.1, it immediately fails with the following
ImportError
:Root cause seems to be that the
html5lib
version used by TensorBoard does not yet include html5lib/html5lib-python#403. For a proper fix,html5lib
should be updated to 1.1, which includes the fix.Workaround: Manually changing
from collections import [..]
tofrom collections.abc import [..]
in~/.local/lib/python3.10/site-packages/tensorboard/_vendor/html5lib/_trie/_base.py
resolves the issue.The text was updated successfully, but these errors were encountered: