-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to install the python library inside a virtualenv? #3029
Comments
Are you using pipenv? If so, you can install bcc normally and pass --site-packages as a flag to pipenv as a workaround. As far as I know, there is no good way to get bcc working properly with a virtual environment. |
If you already created the virtual env, you can copy the bcc dir to your virtualenv's lib dir. I'm not sure whether symlink would work. |
You can also workaround this by importing bcc from the global location. Example for Debian: try:
import bcc
except ImportError:
spec = importlib.util.spec_from_file_location("bcc", "/usr/lib/python3/dist-packages/bcc/__init__.py")
if spec:
module = importlib.util.module_from_spec(spec)
sys.modules['bcc'] = module
spec.loader.exec_module(module) |
After following the instructions in the INSTALL.md file, I can successfully import
bcc
from the system python interpreter (v3.6). But I cannot importbcc
from the python within the virtualenv (v3.7). I want to write BPF program with some 3.7 features (time.time_ns
) How can I install the python bcc library inside a virtualenv? I'm used to installing per-virtualenv python packages using pip, but this library doesn't seem to have that option. Thanks in advance. :)The text was updated successfully, but these errors were encountered: