# ERROR collecting doctests
File "...", line 1, in <module>
ModuleNotFoundError: No module named 'myapp'

- **ID:** `python/pytest-doctest-missing-module`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest --doctest-modules discovers .py files under the project tree, including examples/ or docs/ that import the package, but the package is not installed or on sys.path.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   pip install -e .
pytest --doctest-modules src/myapp -q
   ```
2. **** (90% success)
   ```
   # pyproject.toml
[tool.pytest.ini_options]
testpaths = ['src/myapp', 'tests']
pythonpath = ['src']
addopts = '--doctest-modules'
   ```

## Dead Ends

- **** — Skips real doctests in examples; other directories still fail if the package is not importable. (60% fail)
- **** — Boilerplate in every file; breaks when run from a different cwd. (70% fail)
