[OSError] No space left on device when I pip install torch

I checked some discussions where they advised to use --no-cache-dir and $TMPDIR methods. But they are not working in my case. I checked the output of df -h and got to know it is loading packages in /run/user/1000 which is only 1.6G which is used 100% and then pip throws this error. I tried increasing size of /run/user/1000 for tmpfs in fstab but it creates some other issues like my sound module wont load.

Try setting TMPDIR only for the pip command.

mkdir ~/tmpdir
TMPDIR=~/tmpdir python3 -m pip install …
1 Like

Alright that seems to have worked but will I have to do every time I install large packages. Or is there any alternative and I would love if you can explain what we did.

will setting TMPDIR in bash create any problems?

I set TMPDIR in my .bash_profile and things work well for me.

If TMPDIR is not set, programs will generally use /tmp. In Fedora, /tmp is on RAM and is cleared on each boot, so there is no risk of it getting too big. If you set TMPDIR somewhere on the disk, it won’t be cleared on boot.

1 Like

Just a note. Setting TMPDIR variable as user xyz, such tmp directory is used only by this user. All processes running as root or other users, still continue to use the default /tmp directory, is it?

Correct. Each user, indeed each process, can have its own tmp.