cannot import name 'Iterable' from 'collections'
See original GitHub issueDescribe the bug
Command Name
az aks get-credentials
Errors:
The command failed with an unexpected error. Here is the traceback:
cannot import name 'Iterable' from 'collections' (/usr/local/Cellar/python@3.10/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 556, in execute
self.commands_loader.load_arguments(command)
File "/usr/local/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/__init__.py", line 517, in load_arguments
self.command_table[command].load_arguments() # this loads the arguments via reflection
File "/usr/local/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 313, in load_arguments
super(AzCliCommand, self).load_arguments()
File "/usr/local/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/knack/commands.py", line 104, in load_arguments
cmd_args = self.arguments_loader()
File "/usr/local/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 125, in arguments_loader
op = self.get_op_handler(self.op_path)
File "/usr/local/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 59, in get_op_handler
handler = import_module(mod_to_import)
File "/usr/local/Cellar/python@3.10/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/fed/.azure/cliextensions/aks-preview/azext_aks_preview/custom.py", line 41, in <module>
from tabulate import tabulate # pylint: disable=import-error
File "/usr/local/Cellar/azure-cli/2.30.0_1/libexec/lib/python3.10/site-packages/tabulate.py", line 16, in <module>
from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/Cellar/python@3.10/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)
To Reproduce:
az aks get-credentials --resource-group {} --name {} --subscription {} --admin
Expected Behavior
Environment Summary
macOS-11.6-x86_64-i386-64bit, Darwin 20.6.0
Python 3.10.0
Installer: HOMEBREW
azure-cli 2.30.0
Extensions:
front-door 1.0.9
aks-preview 0.4.65
Additional Context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:15 (3 by maintainers)
Top Results From Across the Web
cannot import name 'Iterable' from 'collections' in Python
You can use Iterable from collections.abc instead, or use Python 3.9 if the problem is in a dependency that can't be updated.
Read more >ImportError: cannot import name Iterable from 'collections'
Import the Iterable class from collections.abc , as a change was made in Python 3.10. · Update the versions of any modules that...
Read more >ImportError cannot import name Iterabler from collections ...
The Iterable abstract class was removed from collections in Python 3.10. ... ImportError: cannot import name 'Iterable' from 'collections'.
Read more >1926080 – packit fails to build with Python 3.10: ImportError
Bug 1926080 - packit fails to build with Python 3.10: ImportError: cannot import name 'Iterable' from 'collections'.
Read more >【Python】pyecharts库报错cannot import name 'Iterable' ...
解决办法:到安装pyecharts库的目录下,进入pyecharts文件,再打开render,继续打开engine.py文件,在其中找到下面的代码:from collections import ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The issue is with the Python version (>3.9)… Python realigned the modules.
Thank you so much for your solution! I was able to run the command!