# error: package directory 'src/mypkg' does not exist

- **ID:** `python/setuptools-package-dir-and-packages-conflict`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

setup.py declares packages=['mypkg'] and package_dir={'':'src'} but the src/mypkg directory is missing or named differently. Common when scaffolding a src-layout project and forgetting to create the package folder.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (98% success)
   ```
   mkdir -p src/mypkg && touch src/mypkg/__init__.py
   ```
2. **** (95% success)
   ```
   from setuptools import setup, find_packages; setup(packages=find_packages(where='src'), package_dir={'':'src'})
   ```
3. **** (92% success)
   ```
   [tool.setuptools.packages.find]\nwhere = ["src"]
   ```

## Dead Ends

- **** — Build isolation is not the issue; the source tree is malformed. (90% fail)
- **** — find_packages() defaults to where='.' and will not find packages under src/. (70% fail)
