首页 > 解决方案 > pip install 和 pip download 失败,没有空间错误,尽管有足够的空间

问题描述

我在pip install运行时遇到问题,以便可以在现有环境中安装 tensorflow。但是,它一直因无空间错误而崩溃。在我的研究中,我发现 pip 默认情况下会将其包下载到 /tmp。由于它位于根目录下,因此我尝试进行 pip 下载以进行离线安装,并将文件下载到 /home 下的目录中。这失败了同样的错误。

pip download --no-cache-dir tensorflow -d /home/profile1/tmp/

#downloads several packages
Traceback (most recent call last):
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/commands/download.py", line 135, in run
    resolver.resolve(requirement_set)
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 482, in prepare_linked_requirement
    hashes=hashes,
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 287, in unpack_url
    hashes=hashes,
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 164, in unpack_http_url
    unpack_file(from_path, location, content_type)
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/utils/unpacking.py", line 252, in unpack_file
    flatten=not filename.endswith('.whl')
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/site-packages/pip/_internal/utils/unpacking.py", line 139, in unzip_file
    shutil.copyfileobj(fp, destfp)
  File "/home/profile1/anaconda3/envs/testinstall/lib/python3.6/shutil.py", line 82, in copyfileobj
    fdst.write(buf)
OSError: [Errno 28] No space left on device

在使用 `df -h /home' 时,我看到文件系统中还剩下 20 GB,所以这没有任何意义。就补救而言,我还能做些什么吗?

我还能够确认这仅适用于 pip;我能够使用 conda install 来获取 tensorflow,但不能使用 pip。另外,我在尝试下载torch时也发现了同样的错误。

标签: pythondownloadpipinstallation

解决方案


问题在于 /tmp 目录已满。这个问题有几个解决方法:

  • 从不必要的文件中清除 /tmp 目录。
  • 将 TMPDIR 环境变量设置为另一个目录,然后运行 ​​pip。
  • 看看能不能通过likes gpart(ed)增加/tmp目录的空间。

推荐阅读