# Diagnose Venv Shebang Import Errors

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

- Skill: `vamseeachanta/diagnose-venv-shebang-import-errors` (Agent Skill)
- Install (CLI): `npx skillmds@latest add vamseeachanta/diagnose-venv-shebang-import-errors`
- Raw SKILL.md: https://api.skillmd.com/api/skills/vamseeachanta/diagnose-venv-shebang-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-venv-shebang-import-errors

---


# Diagnose Virtual Environment Shebang Import Errors

When a CLI tool fails with ModuleNotFoundError despite the package being installed, check if the entry point shebang (`#!/usr/bin/env python3`) resolves to the system Python instead of the venv Python. Verify by: (1) checking which python the shebang resolves to, (2) confirming the package exists in the venv but not system python, (3) updating the shebang to point directly to the venv's Python binary (e.g., `~/.venv/bin/python3`). If the shebang keeps reverting after updates, investigate post-install hooks that may regenerate entry points with generic shebangs.
