iovisor / iovisor/bcc

Tools from Ubuntu package don't work under Python virtual environment

Open
#2,225 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
5d 13h
Merged PRs (30d)
3

Description

If I'm working with a Python virtual environment activated, then the tools from the Ubuntu package don't work:
```
$ python3 -mvenv t/tt
$ source ./t/tt/bin/activate
$ which python
/home/antoine/t/tt/bin/python
$ /usr/share/bcc/tools/offcputime -h | head -n5
Traceback (most recent call last):
File "/usr/share/bcc/tools/offcputime", line 14, in
from bcc import BPF
ModuleNotFoundError: No module named 'bcc'
```

This is because the scripts use the shebang `#!/usr/bin/env python`. They should probably hard-code the system Python 2.7 install instead, `#!/usr/bin/python2.7`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the installed BCC tool entry point shown in /usr/share/bcc/tools/offcputime and compare its shebang with the issue's proposed system-Python path. Check the other Ubuntu-package tools for the same pattern, then verify that a tool runs with an activated virtual environment and no longer raises ModuleNotFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python, ubuntu
Domain
cli, operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.