[ 
https://issues.apache.org/jira/browse/AMBARI-26522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jialiang Cai resolved AMBARI-26522.
-----------------------------------
    Resolution: Fixed

> 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
>            Priority: Major
>             Fix For: 3.1.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> To fix import errors like
> {code:sh}
> ImportError: cannot import name 'MutableMapping' from 'collections'
> {code}
> ---
> Till python3.9 [DeprecationWarning but works]
> {code:sh}
> 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
> >>>
> {code}
> From python3.10, import fails
> {code:sh}
> 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)
> >>>
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to