infoblox-client icon indicating copy to clipboard operation
infoblox-client copied to clipboard

ImportError: cannot import name 'Mapping' from 'collections'

Open dave-messenger-cbre opened this issue 1 year ago • 0 comments

I wanted to try the Python client to interact with Infoblox but immediately hit an issue. The client imports an additional package (requests) which then imports another (urllib3) that tries to import modules from the collections package. This package has since changed the location of the files to import and then fails with a traceback.

Trying to upgrade the urllib3 package to the latest version also doesn't help as the requirement within the infoblox-client package is for an older release.

Traceback (most recent call last): File "/home/dave/scripts/infoblox-create/./infoblox-create.py", line 3, in from infoblox_client import connector File "/home/dave/.local/lib/python3.10/site-packages/infoblox_client/connector.py", line 19, in import requests File "/home/dave/.local/lib/python3.10/site-packages/requests/init.py", line 43, in import urllib3 File "/home/dave/.local/lib/python3.10/site-packages/urllib3/init.py", line 8, in from .connectionpool import ( File "/home/dave/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 29, in from .connection import ( File "/home/dave/.local/lib/python3.10/site-packages/urllib3/connection.py", line 39, in from .util.ssl_ import ( File "/home/dave/.local/lib/python3.10/site-packages/urllib3/util/init.py", line 3, in from .connection import is_connection_dropped File "/home/dave/.local/lib/python3.10/site-packages/urllib3/util/connection.py", line 3, in from .wait import wait_for_read File "/home/dave/.local/lib/python3.10/site-packages/urllib3/util/wait.py", line 1, in from .selectors import ( File "/home/dave/.local/lib/python3.10/site-packages/urllib3/util/selectors.py", line 14, in from collections import namedtuple, Mapping ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)

Reference: https://stackoverflow.com/questions/69381312/importerror-cannot-import-name-from-collections-using-python-3-10/69727802#69727802

I wanted to highlight this issue for resolution.

dave-messenger-cbre avatar May 15 '24 11:05 dave-messenger-cbre