python install_error ai_generated true

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/setuptools-*.dist-info'

ID: python/pip-no-such-file-or-directory

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2024-02-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.11 active

Root Cause

Pip's build isolation tries to install setuptools into a temporary directory, but the path contains a wildcard or the directory is missing due to a corrupted pip cache or partial uninstall.

generic

中文

Pip的构建隔离尝试将setuptools安装到临时目录,但路径包含通配符或目录因pip缓存损坏或部分卸载而缺失。

Workarounds

  1. 80% success
    pip cache purge && pip install --no-build-isolation somepackage
  2. 75% success
    mkdir -p /usr/local/lib/python3.11/site-packages && touch /usr/local/lib/python3.11/site-packages/setuptools.dist-info
  3. 90% success
    python -m venv venv && source venv/bin/activate && pip install somepackage

Dead Ends

Common approaches that don't work:

  1. 60% fail

    Clears cache but doesn't fix the underlying file system corruption or missing directory.

  2. 80% fail

    Directory may not exist; pip recreates the same broken path due to stale metadata.

  3. 70% fail

    Forces reinstall but still uses the same broken temp path.