简体   繁体   中英

“No space left on device” on Ubuntu when trying to install Tensorflow

I am trying to install Tensorflow 2 on a Linux virtual machine on Oracle Virtualbox using Python 3.8.2. The machine has the following characteristics:

Operating system: Ubuntu 20.04 LTS (64-bit)

GNOME Version: 3.36.1

Windowing System: X11

Memory: 9.5 GiB

Disk Capacity: 10.7 GB

When doing pip install tensorflow==2.2.0 in the terminal, I get the following error at the very last stage (after the download is completed):

ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

Typing du -sh in the terminal yields

12K      .

while df yields

Filesystem     1K-blocks    Used Available Use% Mounted on
udev             4952816       0   4952816   0% /dev
tmpfs             996192    1324    994868   1% /run
/dev/sda5        9736500 6919960   2302236  76% /
tmpfs            4980940       0   4980940   0% /dev/shm
tmpfs               5120       4      5116   1% /run/lock
tmpfs            4980940       0   4980940   0% /sys/fs/cgroup
/dev/loop0         56320   56320         0 100% /snap/core18/1705
/dev/loop1         56320   56320         0 100% /snap/core18/1754
/dev/loop2        246656  246656         0 100% /snap/gnome-3-34-1804/24
/dev/loop3        261760  261760         0 100% /snap/gnome-3-34-1804/36
/dev/loop4         63616   63616         0 100% /snap/gtk-common-themes/1506
/dev/loop5         51072   51072         0 100% /snap/snap-store/433
/dev/loop6         51072   51072         0 100% /snap/snap-store/454
/dev/loop7         27776   27776         0 100% /snap/snapd/7264
/dev/loop8         31104   31104         0 100% /snap/snapd/7777
/dev/sda1         523248       4    523244   1% /boot/efi
tmpfs             996188      24    996164   1% /run/user/1000

I have tried to follow https://www.maketecheasier.com/fix-linux-no-space-left-on-device-error/ and https://github.com/pypa/pip/issues/5816 , but none of their solutions seems to work for me. Can anyone help me figure out what is wrong?

pip downloads files to the temporary directory /tmp during pip install .

The error implies that /tmp ran out of space during installation. Looking at the df output shows that /tmp isn't mounted as a tmpfs mount point, indicating that /tmp is currently mounted under / .

The available storage for / is 2,302,236 1K blocks (from your df output), which is about 2.3 GB (next time use df -h for more readable values).

But by executing:

sudo mount -t tmpfs tmpfs /tmp

a tmpfs is mounted to /tmp . Typically, a tmpfs partition has its maximum size set to half of the available RAM, which in your case would be 4.75GB, essentially doubling the available space available to pip .

probably an inode issue. Try a

df -i

or a number of files open too high Try and kill process related:

find /proc/*/fd -ls | grep '(deleted)'

I am also running Ubuntu 20.04 LTS (64-bit) on Oracle VirtualBox and started getting warnings about low disk space.

The culprit in my case was the /var/cache/apt/archives directory which was taking up 771 MB, it might be the same problem on your system. The cause is obscured by the fact that /var is a directory under / so the storage used is aggregated there and not as a separate mount point.

I used the big-hammer approach sudo apt clean and cleared the cache, trusting that apt will re-download later any packages it might need. The storage used went down from 771 MB to 36 KB.

The answer is too late to help the OP, hopefully it will help someone else.

$ sudo du -ch /var/cache/apt/archives/
4.0K    /var/cache/apt/archives/partial
771M    /var/cache/apt/archives/
771M    total
$ sudo apt clean
$ sudo du -ch /var/cache/apt/archives/
4.0K    /var/cache/apt/archives/partial
36K    /var/cache/apt/archives/
36K    total
$ sudo du -ch -d 1 /var/cache
40K    /var/cache/apt
1.8M    /var/cache/man
40K    /var/cache/dictionaries-common
56K    /var/cache/ldconfig
8.0K    /var/cache/PackageKit
2.6M    /var/cache/fontconfig
20K    /var/cache/cups
15M    /var/cache/app-info
5.2M    /var/cache/debconf
2.1M    /var/cache/fwupd
2.2M    /var/cache/snapd
6.1M    /var/cache/cracklib
4.0K    /var/cache/gdm
484K    /var/cache/private
6.7M    /var/cache/apparmor
42M    /var/cache
42M    total
$

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM