Pip: [Errno 28] No space left on device

Created on 26 Sep 2018  ยท  27Comments  ยท  Source: pypa/pip

Environment
an virtual environment of python3 is created by anaconda.

Description

I want to install tensorflow in my linux server, when i type

pip install   tensorflow-gpu 

the terminal shows:
```Collecting tensorflow-gpu
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/3f/c3/000755084b5e7b5a11df1b9166a54936075ec280b7a615cecce42973fc8b/tensorflow_gpu-1.10.1-cp36-cp36m-manylinux1_x86_64.whl (253.2MB)
99% |############################### | 250.9MB 15.9MB/s eta 0:00:01Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

I use `df -h` find that the /tmp does not have enough space .

so i change the command with --build  as follows:
 `pip install   tensorflow-gpu    --build /data/vincents/  `

However, it gaves the same error:OSError: 

Collecting tensorflow-gpu
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/3f/c3/000755084b5e7b5a11df1b9166a54936075ec280b7a615cecce42973fc8b/tensorflow_gpu-1.10.1-cp36-cp36m-manylinux1_x86_64.whl (253.2MB)
99% |############################### | 250.9MB 54.3MB/s eta 0:00:01Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

```

This is means the --build option in pip didn't specify the /data/vincents/ as the unpacked path.


Edit by @pradyunsg:

Known workarounds: https://github.com/pypa/pip/issues/5816#issuecomment-425205365, https://github.com/pypa/pip/issues/5816#issuecomment-521026876
See closing comment: https://github.com/pypa/pip/issues/5816#issuecomment-587302775

no action auto-locked support

Most helpful comment

I think following will help:

TMPDIR=/data/vincents/ pip install --cache-dir=/data/vincents/ --build /data/vincents/ tensorflow-gpu

All 27 comments

I think following will help:

TMPDIR=/data/vincents/ pip install --cache-dir=/data/vincents/ --build /data/vincents/ tensorflow-gpu

@daa thanks !!! I can install tf with your code !! I dont know why use this "TMPDIR=/data/vincents/" ?

pip downloads files to temporary directory, environment variable TMPDIR specifies that directory, also pip puts files into cache thus --cache-dir specification, --no-cache-dir should work too. --build specifies directory where wheel will be built, so its specification is also useful.

the same problem, pip 18.0:

root@host:/tmp# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
root@host:/tmp# python3 get-pip.py 
Collecting pip
  Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/fc/e9/05316a1eec70c2bfc1c823a259546475bd7636ba6d27ec80575da523bc34/wheel-0.32.1-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Could not install packages due to an EnvironmentError: [Errno 28] No space left on device: '/usr/local/lib/python3.5/dist-packages/pip'

root@host:/tmp# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.8G  6.1G  1.4G  83% /
...
root@host:/tmp# python3 -V
Python 3.5.2
root@host:/tmp# cat /etc/issue
Ubuntu 16.04.2 LTS \n \l

@lega911: this does not look like the same issue, as you have plenty of free space in /tmp. What about in /usr/local/lib/python3.5/?

@benoit-pierre
I have only 1 mounted partition (/) (base configuration of ubuntu),
so /usr/ and other places have 1.4Gb free

Indeed, then something really weird is happening, as pip's wheel only weight 1.3M, and decompress to about 4M...

on Ubuntu 16.04.5 works well with the same python
on Ubuntu 16.04.2 this bug, there is no problem with free space (I can add and remove 100Mb files), no problems with access, because it's root

so it can be a bug in some library pip relied on (which was fixed in last version)

Well, pip vendors its own dependencies, so aside from a bug in Python... I don't see any related update to Python 3.5 in the changelogs for 16.04.3, 16.04.4, or 16.04.5.

I have the same problems on Arch linux:

$ "/usr/bin/virtualenv2" "-p" "/usr/bin/python2.7" "--system-site-packages" "/home/drogus/tmp/yaourt-tmp-drogus/aur-servo-git/src/servo/python/_virtualenv"
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /home/drogus/tmp/yaourt-tmp-drogus/aur-servo-git/src/servo/python/_virtualenv/bin/python2.7
Not overwriting existing python script /home/drogus/tmp/yaourt-tmp-drogus/aur-servo-git/src/servo/python/_virtualenv/bin/python (you must use /home/drogus/tmp/yaourt-tmp-drogus/aur-servo-git/src/servo/python/_virtualenv/bin/python2.7)
Installing setuptools, pip, wheel...
  Complete output from command /home/drogus/tmp/yao...ualenv/bin/python2.7 - setuptools pip wheel:
  Looking in links: /usr/lib/python2.7/site-packages, /usr/lib/python2.7/site-packages/virtualenv_support
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/37/06/754589caf971b0d2d48f151c2586f62902d93dc908e2fd9b9b9f6aa3c9dd/setuptools-40.6.3-py2.py3-none-any.whl
Collecting pip
  Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 2343, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 947, in create_environment
    download=download,
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 904, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 796, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/drogus/tmp/yao...ualenv/bin/python2.7 - setuptools pip wheel failed with error code 1

Let me know if you need any more details (I don't use python in general, so I have no idea what else might be of use)

You need to check inodes: df -i, it can be 100% usage.

I don't think that's the case:

$ df -i | grep Main
/dev/mapper/MainVolumeGroup-root  5431296 657587  4773709   13% /
/dev/mapper/MainVolumeGroup-home 21430272 569579 20860693    3% /home

$ df -h | grep Main
/dev/mapper/MainVolumeGroup-root   82G   52G   27G  67% /
/dev/mapper/MainVolumeGroup-home  321G   72G  233G  24% /home

$ "/usr/bin/virtualenv2" "-p" "/usr/bin/python2.7" "--system-site-packages" "/home/drogus/tmp/yaourt-tmp-drogus/aur-servo-git/src/servo/python/_virtualenv"
Running virtualenv with interpreter /usr/bin/python2.7
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /home/drogus/tmp/yaourt-tmp-drogus/aur-servo-git/src/servo/python/_virtualenv/bin/python2.7
Not overwriting existing python script /home/drogus/tmp/yaourt-tmp-drogus/aur-servo-git/src/servo/python/_virtualenv/bin/python (you must use /home/drogus/tmp/yaourt-tmp-drogus/aur-servo-git/src/servo/python/_virtualenv/bin/python2.7)
Installing setuptools, pip, wheel...
  Complete output from command /home/drogus/tmp/yao...ualenv/bin/python2.7 - setuptools pip wheel:
  Looking in links: /usr/lib/python2.7/site-packages, /usr/lib/python2.7/site-packages/virtualenv_support
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/37/06/754589caf971b0d2d48f151c2586f62902d93dc908e2fd9b9b9f6aa3c9dd/setuptools-40.6.3-py2.py3-none-any.whl
Collecting pip
  Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 2343, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 947, in create_environment
    download=download,
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 904, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python2.7/site-packages/virtualenv.py", line 796, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/drogus/tmp/yao...ualenv/bin/python2.7 - setuptools pip wheel failed with error code 1
zsh: command not found: Running

Maybe I thought about another case, probably this one I solved just starting my script inside of the docker with fresh ubuntu.

Ok, sorry for that, but it seems that my problem was a legitimate case. The problem appeared when I was installing some stuff using yaourt on Arch and I've set its temp directories to the path in my home dir. Despite that it seems that something related to virtualenv needed to write to the /tmp directory and I haven't noticed that my /tmp is a tmpfs and not shared with the main partition (I only recently got back to Linux after a long break, so I didn't even realize that it's done in this way now). In any case, after clearing the /tmp dir it works correctly

I get the same error

C:\WINDOWS\system32>pip3 list
Package Version


astor 0.8.0
numpy 1.17.0
opencv-python 4.1.0.25
pip 19.2.1
setuptools 40.8.0
six 1.12.0
wheel 0.33.4

C:\WINDOWS\system32>pip3 install --upgrade tensorflow
Collecting tensorflow
Using cached https://files.pythonhosted.org/packages/f7/08/25e47a53692c2e0dcd2211a493ddfe9007a5cd92e175d6dffa6169a0b392/tensorflow-1.14.0-cp37-cp37m-win_amd64.whl
ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

Hi @MrBermudez. Please check whether any of your drives are full or close to full. On Windows you should be able to get this info by running wmic logicaldisk get size,freespace,caption in the command prompt. The easiest thing to do is make enough space in the drive that has your temp directory (echo %TEMP% to see it), your target virtual environment, and your cache directory (should be %LOCALAPPDATA%).

out-of-the-box-thinking solution: clear out extra cruft in /tmp/.

pip install --no-cache-dir tensorflow-gpu
solved it for me.

Thank you. It worked.

Sent from my T-Mobile 4G LTE Tablet

I think following will help:

TMPDIR=/data/vincents/ pip install --cache-dir=/data/vincents/ --build /data/vincents/ tensorflow-gpu

Wouldn't it be wiser to also use the environment variable in the pip command?

Firstly, to update pip to the latest version(pip3 install --upgrade pip --user),then
TMPDIR=/home/(your hostname)/torch/ pip3 install --cache-dir=/home/(your hostname)/torch/ --build /home/(your hostname)/torch/ torch --user
eg:
TMPDIR=/home/shawn/torch/ pip3 install --cache-dir=/home/shawn/torch/ --build /home/shawn/torch/ torch --user

Result:
Collecting torch
Downloading https://files.pythonhosted.org/packages/b4/0b/9d33aef363b6728ad937643d98be713c6c25d50ce338678ad57cee6e6fd5/torch-1.3.0-cp37-cp37m-manylinux1_x86_64.whl (773.1MB)
|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 773.1MB 12kB/s
Requirement already satisfied: numpy in ./.local/lib/python3.7/site-packages (from torch) (1.16.2)
Installing collected packages: torch
Successfully installed torch-1.3.0

hello friends , i had the same issue , I just rebooted my computer and it worked .
I think its a problem of ram .

pip install --no-cache-dir tensorflow-gpu
solved it for me.

This worked. Python3 + Ubuntu 18.04LTS.

I hit this error while building docker image.

DockerBuild:
ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device: '/home/myuser/.local/lib/python3.6/site-packages/tensorflow_core/python/training/saving'

Resolved by pruning all the images that I have accumulated over several days. ~4.6GB.

Is there anything actionable here on pip's end; given that this is a fairly system-configuration-specific error?

no action. just reporting resolution on this error.

The only solution here is to ensure that your $TMPDIR, cache location and install location (usually in /usr/local/ or ~/) have enough space -- for downloading the archives and unpacking them for the packages to be installed.

The answer for how to do that is very system-specific and dependent on a lot of factors (such as available hardware, policies of the organization if it's an organization-owned system etc) which means we can't provide more detailed advice for users, in general.

More resources on how to deal with this kind of issue can be found by googling "linux /tmp No space left on device", such as https://www.linuxquestions.org/questions/linux-newbie-8/having-problem-with-tmp-no-space-left-on-device-error-727905/

There isn't much actionable from pip's end here -- "ensure you have enough space in $TMPDIR, pip's cache location and install location for packages, via some mechanism provided by your OS" really is the best advice we can provide in these cases. :(

I'm going to go ahead and close this issue, but if anyone has any suggestions for how to improve / provide better advice to users, please feel free to file an new issue to discuss that.

Was this page helpful?
0 / 5 - 0 ratings