# Diagnose Shebang Virtualenv Import Errors

> Debugging pattern for ModuleNotFoundError when CLI entry points use wrong Python interpreter

- Skill: `vamseeachanta/diagnose-shebang-virtualenv-import-errors` (Agent Skill)
- Install (CLI): `npx skillmds@latest add vamseeachanta/diagnose-shebang-virtualenv-import-errors`
- Raw SKILL.md: https://api.skillmd.com/api/skills/vamseeachanta/diagnose-shebang-virtualenv-import-errors/raw
- Safety review: PASS (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: vamseeachanta (https://skillmd.com/u/vamseeachanta)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/vamseeachanta/diagnose-shebang-virtualenv-import-errors

---


# Diagnose Shebang vs Virtual Environment Import Errors

When a CLI tool installed in a venv throws ModuleNotFoundError for packages that exist in that venv, check if the entry point shebang uses the system Python instead of the venv Python. Verify the actual shebang in ~/.local/bin/<tool>, check which python it resolves to with `which python3`, and compare against the venv's bin/python3 path. If mismatched, update the shebang to point directly to the venv interpreter. Note: this can revert on tool updates if the installer regenerates the entry point.
