ERROR pip system_error ai_generated partial

ERROR: Could not install packages due to an OSError: [Errno 36] File name too long

ID: pip/wheel-install-fails-with-errno-36-file-name-too-long

Also available as: JSON · Markdown · 中文
75%Fix Rate
82%Confidence
1Evidence
2023-11-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 21.0+ active
Python 3.6-3.12 active
Linux kernel 5.x+ active
Windows 10/11 active

Root Cause

The extracted wheel file or a path within it exceeds the filesystem's maximum filename length (typically 255 bytes on Linux/ext4, 260 characters on Windows).

generic

中文

解压后的 wheel 文件或其内部路径超过了文件系统的最大文件名长度(Linux/ext4 上通常为 255 字节,Windows 上为 260 个字符)。

Official Documentation

https://docs.python.org/3/library/os.html#os.pathconf

Workarounds

  1. 80% success pip install <package> --target /tmp/shorter-path
    pip install <package> --target /tmp/shorter-path
  2. 70% success pip install <package> --no-compile --no-deps --no-build-isolation
    pip install <package> --no-compile --no-deps --no-build-isolation
  3. 85% success On Linux: install to a filesystem with longer filename limits (e.g., XFS or ext4 with dir_nlink) or use a symlink to shorten the path: mkdir -p /tmp/shortpip && ln -s /tmp/shortpip ~/shortpip && pip install <package> --target ~/shortpip
    On Linux: install to a filesystem with longer filename limits (e.g., XFS or ext4 with dir_nlink) or use a symlink to shorten the path: mkdir -p /tmp/shortpip && ln -s /tmp/shortpip ~/shortpip && pip install <package> --target ~/shortpip

中文步骤

  1. pip install <包名> --target /tmp/短路径
  2. pip install <包名> --no-compile --no-deps --no-build-isolation
  3. 在 Linux 上:安装到具有较长文件名限制的文件系统(例如 XFS 或带 dir_nlink 的 ext4),或使用符号链接缩短路径:mkdir -p /tmp/shortpip && ln -s /tmp/shortpip ~/shortpip && pip install <包名> --target ~/shortpip

Dead Ends

Common approaches that don't work:

  1. Using --no-cache-dir option to avoid cache path issues 95% fail

    The error occurs during wheel extraction, not caching; the filename length issue remains regardless of cache.

  2. Upgrading pip to the latest version 90% fail

    This is an OS-level filesystem limitation; pip's version does not affect filename length constraints.

  3. Running pip as administrator or root 95% fail

    Administrator privileges cannot override filesystem filename length limits.