'BeautifulSoup AttributeError 'collections' has no attribute 'Callable'

I followed all steps to install the beautifulsoup but it still comes out with this error:

AttributeError: module 'collections' has no attribute 'Callable'

stacktrace

I am using python 3.10.



Solution 1:[1]

import collections
collections.Callable = collections.abc.Callable

use this !

Solution 2:[2]

Got same AttributeError, Then look inside python lib > collections folder has abc (abstract base classes) made separately in version 3.3 and above. So resolving error by opening /bs4/elements.py in editor and replacing collections.callable >> to >> collections.abc.callable hence callable attribute can be easily accessed.

Solution 3:[3]

BeautifoulSoup did not work with 3.10 reinstall 3.9 Shoikan

Solution 4:[4]

Change “C:\Users\AppData\Local\Programs\Python\Python310\Lib\site-ackages\pyreadline
py3k_compat.py” 8th code as below:

return isinstance(x, collections.abc.Callable)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alinajafi
Solution 2
Solution 3 Shoikan
Solution 4 YC Chan