# error: package directory 'mypackage' does not exist

- **ID:** `python/setuptools-package-discovery-failed`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

setuptools cannot find the package directory specified in setup.py's packages or package_dir argument. This happens when the directory name is misspelled or the package structure is incorrect.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.7 | active | — | — |
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Verify the package directory exists and matches the name in setup.py. Use find_packages() to automatically discover packages.
   ```
2. **** (90% success)
   ```
   If using src layout, specify package_dir={'': 'src'} and ensure the directory structure is correct.
   ```

## Dead Ends

- **** — The package won't contain the intended modules, leading to import errors at runtime. (80% fail)
- **** — setuptools may not include any packages, resulting in an empty distribution. (75% fail)
