You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Gandhe harshith (Jira)" <ji...@apache.org> on 2025/07/01 05:42:00 UTC
[jira] [Created] (AMBARI-26522) Fix ImportError for collections, renamed in python3.10
Gandhe harshith created AMBARI-26522:
----------------------------------------
Summary: Fix ImportError for collections, renamed in python3.10
Key: AMBARI-26522
URL: https://issues.apache.org/jira/browse/AMBARI-26522
Project: Ambari
Issue Type: Bug
Affects Versions: 3.0.0
Reporter: Gandhe harshith
Fix For: 3.1.0
To fix import errors like
```
ImportError: cannot import name 'MutableMapping' from 'collections'
```
---
Till python3.9 [DeprecationWarning but works]
```bash
Python 3.9.23 (main, Jun 12 2025, 02:35:45)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections import Mapping
<stdin>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
>>> from collections.abc import Mapping
>>>
```
From python3.10, import fails
```bash
Python 3.10.18 (main, Jun 12 2025, 02:22:13) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections.abc import Mapping
>>>
>>> from collections import Mapping
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)
>>>
>>>
```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ambari.apache.org
For additional commands, e-mail: issues-help@ambari.apache.org