python
system_error
ai_generated
true
错误:由于 OSError:[Errno 28] 设备上没有剩余空间,无法安装包
ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device
ID: python/pip-install-error-errno-28-no-space-left-on-device
80%修复率
85%置信度
0证据数
2024-03-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
pip 安装失败,因为 pip 缓存或 site-packages 所在磁盘分区空间已满。常见于 /tmp 或根文件系统已满的情况。
English
The pip installation fails because the disk partition where pip's cache or site-packages resides has run out of free space. This commonly happens when /tmp or the root filesystem is full.
解决方案
-
95% 成功率
pip cache purge && sudo apt-get clean && rm -rf /tmp/*
-
85% 成功率
pip install --target=/mnt/bigdisk/python-packages package_name
-
80% 成功率
export TMPDIR=/mnt/bigdisk/tmp && pip install package_name
无效尝试
常见但无效的做法:
-
70% 失败
Disabling cache does not free existing filesystem space and may still require temporary space for wheel building.
-
90% 失败
Timeout is unrelated to disk space; the error persists.
-
80% 失败
Elevated privileges do not create disk space and may write to a different partition but still fail.