python config_error ai_generated true

error: package directory 'mypackage' does not exist

ID: python/setuptools-package-discovery-failed

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2025-08-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.7 active — — —
3.8 active — — —
3.9 active — — —
3.10 active — — —

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.

generic

中文

setuptools 找不到 setup.py 中 packages 或 package_dir 参数指定的包目录。这发生在目录名拼写错误或包结构不正确时。

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

Common approaches that don't work:

  1. 80% fail

    The package won't contain the intended modules, leading to import errors at runtime.

  2. 75% fail

    setuptools may not include any packages, resulting in an empty distribution.