Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bcc: ImportError cannot import name BPF

Tags:

bpf

ebpf

bcc-bpf

I am getting the following error when trying run the example hello_world.py.

Traceback (most recent call last):
  File "/usr/share/bcc/examples/hello_world.py", line 9, in <module>
    from bcc import BPF
ImportError: cannot import name BPF

I installed bcc from source (link). I also installed both the python bcc bindings packages, python-bcc and python3-bcc but no luck.

I am running Ubuntu 18.04 and kernel version 4.15.0-117-generic.

What am I missing here?

like image 710
Sagar Rakshe Avatar asked Nov 01 '25 22:11

Sagar Rakshe


1 Answers

In ubuntu 20.04, I execute the following command to fix it.

sudo apt-get install bpfcc-tools linux-headers-$(uname -r)
like image 94
HobbyTan Avatar answered Nov 03 '25 21:11

HobbyTan