python
config_error
ai_generated
true
error: package directory 'src/mypackage' does not exist
ID: python/setuptools-package-dir-not-found
80%Fix Rate
85%Confidence
0Evidence
2024-05-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
Root Cause
The directory specified in 'packages' or 'package_dir' does not exist on disk.
generic中文
在'packages'或'package_dir'中指定的目录在磁盘上不存在。
Workarounds
-
95% success Create the missing directory with __init__.py
mkdir -p src/mypackage touch src/mypackage/__init__.py
-
90% success Update setup.py to match existing structure
from setuptools import find_packages setup( packages=find_packages(where='src'), package_dir={'': 'src'} )
Dead Ends
Common approaches that don't work:
-
Creating a placeholder __init__.py in wrong location
80% fail
The directory structure must match exactly; wrong location doesn't fix.
-
Removing package_dir entirely
60% fail
Breaks package discovery; setuptools may look in wrong place.