IOError:[Errno 28]安装TensorFlow时设备上没有剩余空间

Oma*_*hab 17 python linux pip python-2.7 tensorflow

我正在尝试使用以下命令在我的本地目录中安装TensorFlow.

export TF_BINARY_URL=http://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl
pip install --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

IOError: [Errno 28] No space left on device
Run Code Online (Sandbox Code Playgroud)

然后我df看到了以下内容:

Filesystem             1K-blocks       Used   Available Use% Mounted on
tmpfs                      10240      10240           0 100% /tmp
tmpfs                      10240      10240           0 100% /var/tmp
Run Code Online (Sandbox Code Playgroud)

有没有办法安装TF而没有下载临时文件/tmp/var/tmp?谢谢.

小智 26

通常,您可以将环境变量'TMPDIR'设置为使用除/ tmp或/ var/tmp之外的其他目录,并且大多数程序都会遵守该目录.

你也许可以尝试,

$ export TMPDIR = $ HOME/tmp

然后开始'pip install'

  • 请务必创建文件夹:`mkdir -p $TMPDIR` 不这样做会给我带来问题。 (4认同)
  • 很好的建议,并且易于使用。我会进一步建议您更像这样运行它:`TMPDIR = tmp pip install <package>`如果稍后在同一外壳中,可能会忘记导出。 (3认同)
  • 你的解决方案在我的案例中有效@lingfish (2认同)

Tho*_*ltz 11

您可以使用'pip install -b/some/other/dir'来更改构建目录.

您也可以在这里看到更改方向盘目录 https://pip.pypa.io/en/stable/user_guide/#installation-bundles

跑步pip help install也可以获得其他目录选项.

-b, --build <dir>           Directory to unpack packages into and build in.
-t, --target <dir>          Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with new versions.
-d, --download <dir>        Download packages into <dir> instead of installing them, regardless of what is already installed.
--src <dir>                 Directory to check out editable projects into. The default in a virtualenv is "<venv path>/src". The default for global installs is "<current dir>/src".
Run Code Online (Sandbox Code Playgroud)


Sat*_*esh 6

export TMPDIR=/bigspace/space
Run Code Online (Sandbox Code Playgroud)

为什么?:很可能 /tmp 目录由于某种原因没有足够的空间。

在 pip 安装过程中,pip 将使用 /tmp 目录来执行安装所需的操作(例如下载源等)。

因此,如果 /tmp 中没有足够的空间来安装软件包所需的空间,那么您将收到磁盘空间错误。

您可以使用以下命令配置 /tmp 目录位置


小智 5

在 /home/myuser 上创建 tmp 文件夹,然后在终端中执行“export TMPDIR=/home/$USER/tmp”


ene*_*epo 5

解决方案 1: 在此解决方案中,Pip 不会重新下载包,但在其他解决方案中会重新下载包

使用以下命令检查可用磁盘空间df -h

如果您只需要更改 tmpfs 大小,可以使用新大小在线重新挂载它:

$ sudo mount -o remount,size=10G /tmp
$ sudo mount -o remount,size=10G /var/tmp
Run Code Online (Sandbox Code Playgroud)

解决方案2: 您可以为pip设置环境变量'TMPDIR'

$ export TMPDIR=$HOME/new/tmp/dir
$ pip install --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
Run Code Online (Sandbox Code Playgroud)

解决方案 3: 使用自定义缓存/临时目录

$ pip install --cache-dir=$HOME/new/tmp/dir/  --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
Run Code Online (Sandbox Code Playgroud)

解决方案 4: 没有缓存目录

pip install --no-cache-dir --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
Run Code Online (Sandbox Code Playgroud)