bcc icon indicating copy to clipboard operation
bcc copied to clipboard

install python3-bpfcc to conda environment

Open zhangzhiqiangcs opened this issue 1 year ago • 1 comments

After install python3-bpfcc and libbpfcc, the script python3 -c "from bcc import BPF; print('BCC installed successfully')" is OK. But if you use conda environment, it will output error with No module named 'bcc'. What is the way to install python3-bpfcc into a conda environment.

zhangzhiqiangcs avatar Sep 11 '24 01:09 zhangzhiqiangcs

I attempted to install the package from source, but encountered the same issue of missing the bcc package. This seems to be due to differences between the Python version used by Conda and my system's default Python, as well as differing sys.path. I eventually resolved the problem by copying the bcc files obtained from the source installation directly into a path included in Conda's sys.path. Specifically, I used the following command:

sudo cp -r /path-to-cloned-bcc-repo/build/src/python/bcc-python3/bcc /root/miniconda3/lib/python3.12/site-packages/

wan-nan avatar Dec 03 '24 13:12 wan-nan