【问题标题】:IOError: [Errno 28] No space left on device while installing TensorFlowIOError:[Errno 28] 安装 TensorFlow 时设备上没有剩余空间
【发布时间】:2017-04-06 22:33:39
【问题描述】:

我正在尝试使用以下命令在我的本地目录中安装 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

我收到以下错误:

IOError: [Errno 28] No space left on device

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

Filesystem             1K-blocks       Used   Available Use% Mounted on
tmpfs                      10240      10240           0 100% /tmp
tmpfs                      10240      10240           0 100% /var/tmp

有没有一种方法可以安装 TF 而无需在 /tmp/var/tmp 中下载临时文件?谢谢。

【问题讨论】:

    标签: python linux python-2.7 pip tensorflow


    【解决方案1】:

    通常,您可以将环境变量 'TMPDIR' 设置为使用 /tmp 或 /var/tmp 以外的其他目录,并且大多数程序都会遵循这一点。

    你可以试试,

    $ export TMPDIR=$HOME/tmp

    然后开始你的'pip install'

    【讨论】:

    • 很好的建议,而且易于使用。我进一步建议您像这样运行它:TMPDIR=tmp pip install <package> 如果在同一个 shell 中,您稍后可能会忘记导出。
    • 一定要创建文件夹:mkdir -p $TMPDIR 不这样做会给我带来问题。
    【解决方案2】:

    您也许可以使用 '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".
    

    【讨论】:

    • -b --build 已被弃用,并且在设置 --build 标志时仍然在 TMPDIR 中完成 C 文件的编译。设置“TMPDIR”对我有用。
    【解决方案3】:

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

    【讨论】:

    • 哟,其实这个帮助更多
    【解决方案4】:
    export TMPDIR=/bigspace/space
    

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

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

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

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

    【讨论】:

      【解决方案5】:

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

      使用df -h检查可用磁盘空间:

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

      $ sudo mount -o remount,size=10G /tmp
      $ sudo mount -o remount,size=10G /var/tmp
      

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

      $ export TMPDIR=$HOME/new/tmp/dir
      $ pip install --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
      

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

      $ pip install --cache-dir=$HOME/new/tmp/dir/  --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
      

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

      pip install --no-cache-dir --install-option="--prefix=$PYTHONUSERBASE" --upgrade $TF_BINARY_URL
      

      【讨论】:

        猜你喜欢
        • 2017-09-20
        • 1970-01-01
        • 2021-01-07
        • 1970-01-01
        • 2019-08-01
        • 2022-07-03
        • 2015-04-19
        • 2020-09-26
        • 1970-01-01
        相关资源
        最近更新 更多