Cannot install pip module because there is 'no space' left on device
When I try to install the pytorch module for python3.8 pip complains that there is no space left on the device e.g.
$ pip3 install torch
Collecting torch
Using cached torch-1.8.1-cp38-cp38-manylinux1_x86_64.whl (804.1 MB)
ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device
But according to df there should be enough space around both on the system partition as well as in tmpfs.
Output from df:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.7G 0 7.7G 0% /dev
tmpfs 1.6G 20M 1.6G 2% /run
/dev/nvme0n1p4 23G 20G 2.3G 90% /
tmpfs 7.7G 127M 7.6G 2% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.7G 0 7.7G 0% /sys/fs/cgroup
/dev/nvme0n1p5 183G 48G 126G 28% /home
/dev/nvme0n1p1 256M 37M 220M 15% /boot/efi
tmpfs 1.6G 5.8M 1.6G 1% /run/user/1000
I did try to use a different TMP_DIR as suggested by some StackOverflow answers like this one but that did not fix the problem in my case. My system drive seems to be a bit full but it looks like there should be enough space to install the package. I also tried to install the package locally (e.g. pip3 install --user
) but that did not help either.
Pip worked for all the other packages I tried to install but for this one. Though the other packages were notably smaller.
Ubuntu version: 20.04.1 LTS
Pip version: 20.0.2 for python 3.8
The most likely cause is lack of space in /tmp
. The workaround is to instruct pip
to use an alternative folder. I use the following formulation:
TMPDIR=/home/user/tmp/ python3 -m pip install a_package
I tried using the cache-dir
argument but it fails with a "file not found" error.