A Python virtual environment (venv) is an isolated Python environment that allows you to install packages without affecting your system Python installation. Think of it as a sandbox for your project.
✅ Isolation: Dependencies don't conflict with system packages ✅ Reproducibility: Same environment on any machine ✅ Clean: Easy to delete and recreate ✅ Safe: Won't break system Python tools
NO - The virtual environment does NOT affect your ability to debug locally. Here's why:
- Python interpreter (copy/link to system Python)
- Project dependencies (prompt_toolkit, rich, ibm-watsonx-ai, etc.)
- Project code (Compiler Copilot)
- ✅ Your debugger (GDB/LLDB) - runs natively on your system
- ✅ Your compiler (Clang/LLVM) - runs natively on your system
- ✅ Your programs being debugged - run natively
- ✅ System tools (nm, objdump, readelf) - run natively
- ✅ File system access - full access to your machine
- ✅ Network access - full network connectivity
./setup.sh
# This creates venv/ directory with Python packagessource venv/bin/activate
# Your prompt changes to show (venv)./compiler-copilot.sh
# Runs the interactive shell┌─────────────────────────────────────────────────────┐
│ Compiler Copilot Shell (Python in venv) │
│ - Interprets your commands │
│ - Talks to IBM BOB │
│ - Displays results │
└──────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ GDB/LLDB (Native System Process) │
│ - Runs on your actual machine │
│ - Debugs your actual programs │
│ - Full system access │
└──────────────┬──────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Your Program (Native) │
│ - Runs on your actual machine │
│ - Uses your actual files │
│ - Full system access │
└─────────────────────────────────────────────────────┘
# 1. Activate virtual environment
source venv/bin/activate
# 2. Start Compiler Copilot
./compiler-copilot.sh
# 3. In the shell, debug your local program
copilot> debug /home/user/myproject/myprogram
# GDB starts and debugs your ACTUAL program on your ACTUAL machine
copilot> run
# Your program runs NATIVELY on your machine
copilot> backtrace
# GDB shows ACTUAL backtrace from your program
copilot> examine /home/user/myproject/source.c
# Reads your ACTUAL source file-
Python Package Imports
from rich.console import Console # Loaded from venv/ from ibm_watsonx_ai import APIClient # Loaded from venv/
-
Python Interpreter
which python # Points to venv/bin/python
-
System Commands
which gdb # /usr/bin/gdb (system) which clang # /usr/bin/clang (system) which nm # /usr/bin/nm (system)
-
File Access
# Can access ANY file on your system /home/user/projects/ /opt/compiler/ /tmp/ -
Network
# Full network access - IBM BOB API calls - Git operations - Package downloads
# Your customer's code is at /customer/issue/code.c
source venv/bin/activate
./compiler-copilot.sh
copilot> debug /customer/issue/program
# Debugs the ACTUAL customer program
# Reads ACTUAL customer files
# Uses ACTUAL system GDBcopilot> generate ir /customer/issue/code.c
# Uses ACTUAL system Clang
# Reads ACTUAL customer file
# Generates IR on your ACTUAL machinecopilot> run nm /customer/issue/binary
# Uses ACTUAL system nm
# Analyzes ACTUAL customer binaryWhen you're done:
deactivate
# Exits the virtual environment
# Your system returns to normal- Shell runs in one terminal
- You can open another terminal for manual commands
- Both access the same files and programs
- Everything runs on YOUR machine
- No containers, no VMs, no remote execution
- Direct access to all your tools
- Set REPO_PATH in config/.env
- Access any repository on your machine
- Full file system access
Edit config/.env:
# Point to YOUR tools on YOUR machine
DEBUGGER_PATH=/usr/bin/gdb
CLANG_PATH=/usr/bin/clang
NM_PATH=/usr/bin/nm
OBJDUMP_PATH=/usr/bin/objdump
# Point to YOUR repository
REPO_PATH=/home/user/my-compiler-project
# IBM BOB credentials
IBM_BOB_API_KEY=your_key
IBM_BOB_PROJECT_ID=your_projectProblem: System commands not found Solution: Virtual environment doesn't affect system commands. Check your PATH:
echo $PATH
# Should include /usr/bin, /usr/local/bin, etc.Problem: File permission issues Solution: Virtual environment doesn't change permissions. Check file access:
ls -la /path/to/file
# Fix permissions if neededProblem: GDB issues Solution: Virtual environment doesn't affect GDB. Check GDB directly:
which gdb
gdb --version
# Install if needed: sudo apt-get install gdbThe virtual environment is ONLY for Python packages.
It does NOT:
- ❌ Containerize your environment
- ❌ Isolate your file system
- ❌ Affect system tools
- ❌ Limit network access
- ❌ Change how GDB/LLDB work
- ❌ Affect your programs
It ONLY:
- ✅ Manages Python packages
- ✅ Keeps dependencies organized
- ✅ Makes the project portable
You have FULL access to your machine, files, and tools!
# Setup (once)
./setup.sh
# Start session
source venv/bin/activate
./compiler-copilot.sh
# Debug anything on your machine
copilot> debug /any/path/to/program
copilot> analyze /any/path/to/file
# End session
deactivateThe virtual environment is just a Python package manager - nothing more!