iovisor / iovisor/bcc

ImportError: cannot import name 'BPF' from 'bcc' (unknown location)

Open
#4,972 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

I have built bcc from source.
The directory where it was built was:
/home/pegasus_vm/Documents/eBPFShield/bcc/build
When I try to run python main.py -h
It throws the following error:
`ImportError: cannot import name 'BPF' from 'bcc' (unknown location)`
How to fix it?

I've also added bpf build to the path like this in `~/.bashrc`:
```
bcctools=/home/pegasus_vm/Documents/eBPFShield/bcc/build/tools
bccexamples=/home/pegasus_vm/Documents/eBPFShield/bcc/build/examples
export PATH=$bcctools:$bccexamples:$PATH
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing `python main.py -h` and checking how Python resolves `bcc` after the source build in `/home/pegasus_vm/Documents/eBPFShield/bcc/build`. Review the built tools, examples, and the `~/.bashrc` PATH entries to determine whether the Python binding containing `BPF` is available; done means the command imports `BPF` successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.