1

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

1
  • 1
    "it looks like there should be enough space" Your system, which is very good at math, gently disagrees with you. Download size is not the same as uncompressed size or installed size. Your root partition seems simply too small for what you want to accomplish. It's a common new-user trap: You created a separate /home partition to be clever about space management, but misjudged your usage. Advice: Back up your data and re-partition.
    – user535733
    Mar 26, 2021 at 15:23

2 Answers 2

2

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.

1
  • I also recognized it as a lack of space in /tmp, but the flag did not help. I extended tmp in the end
    – xeruf
    Mar 14 at 8:34
0

I had that problem once on my raspi. It is the /tmp directory that is too small. So in order to install something with pip i created a /tmp dir somewhere not in memory:

pip install cache-dir=/home/user/tmp ...

The export TMPDIR you refered to did not work..

Then it worked...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.