bcc
bcc copied to clipboard
Python 3.10.4 - ImportError: cannot import name 'MutableMapping' from 'collections'
Hi there! I just installed bcc on new a Ubuntu machine and got this error when I trying to import bcc:
Python 3.10.4 (main, Jul 29 2022, 12:34:00) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bcc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 27, in <module>
from .table import Table, PerfEventArray
File "/usr/lib/python3/dist-packages/bcc/table.py", line 15, in <module>
from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/opt/python/3.10.4/lib/python3.10/collections/__init__.py)
uname -a
output:
Linux codespaces-870cdf 5.4.0-1086-azure #91~18.04.1-Ubuntu SMP Thu Jun 23 20:33:05 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
When someone asked in Stack Overflow 6 months ago about this error, the answers pointed that: "The direct import has been deprecated since Python 3.3 and will stop working in Python 3.9. You need to import using: from collections.abc import MutableMapping
".
Maybe I’m missing something and BCC is not currently supported by python 3.10 :) Thanks a lot, Amir.
Hi,
How did you install bcc? This is supposedly fixed since #3144. Close to 2 years ago.
Hi @chantra, I followed the installtion tutorial on this new Ubuntu machine. Is there any additional information I can provide you about this error or my setup?
Try build from source.
Please close the issue. In the same Ubuntu , bcc works for me.
@amir9339 Do check version installed package
sudo apt list bcc-tools
if its not latest try using iovisor repo while installing don't forget to uninstall previously installed bcc.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD
echo "deb https://repo.iovisor.org/apt/$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/iovisor.list
sudo apt-get update
sudo apt-get install bcc-tools libbcc-examples linux-headers-$(uname -r)