Search code examples
pythonpython-3.xundetected-chromedriver

undetected-chromedriver import is unsuccessful. ImportError: cannot import name 'Mapping' from 'collections'


I tried to import undetected_chromedriver

import undetected-chromedriver.v2 as uc

driver = uc.Chrome()

resp = driver.get("https://google.com")

Running above code throws following error.

File "C:\Users\Narmu\Desktop\Python_Workspace_Master\venv\lib\site-packages\undetected_chromedriver\cdp.py"

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

I search for about collections packages but it is not available in package list

I found a suggestion from in VS Code ImportError: cannot import name 'Mapping' from 'collections'?.

But collections.abc also not available in package list.

I use python verion 3.10.

To make this work, kindly suggest me.


Solution

  • Answer as of 12/11/2021: Don't use Python 3.10. It has bug here and there with undetected_chromedriver package.

    I downgraded to 3.7.9 and now all running perfectly fine. You may try other Python version though.