# error: Multiple top-level packages discovered in a flat-layout: ['pkg1', 'pkg2'].

- **ID:** `python/setuptools-find-packages-no-init`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

When using find_packages() without specifying where, setuptools detects multiple top-level packages in the current directory, which is ambiguous and not allowed.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Specify the source directory: `packages=find_packages(where='src')` and move packages to src/ layout.
   ```
2. **** (95% success)
   ```
   Explicitly list packages: `packages=['pkg1', 'pkg2']` in setup.py.
   ```
3. **** (80% success)
   ```
   Use `find_namespace_packages()` for namespace packages if applicable.
   ```

## Dead Ends

- **** — This is not practical if both packages are needed; and the error is about configuration, not about having multiple packages. (40% fail)
- **** — This will cause no packages to be installed, defeating the purpose. (90% fail)
- **** — This still leaves pkg2 undiscovered and may not include all needed modules. (50% fail)
