Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python_OSError: [Errno 28] No space left on device

I have the following error while exporting pandas dataframe into csv file. I have enough space on my hard disk.

OSError: [Errno 28] No space left on device

What can be the reason for this? Many thanks in advance.

like image 449
Khalid Avatar asked Sep 05 '25 03:09

Khalid


2 Answers

I was using pipenv to install package.
I didn't have enough space in /tmp folder in linux, so solution was to temporary set another folder in TMPDIR env variable.

export TMPDIR=/path/to/directory/with/lot/of/space

More info about TMPDIR: docs.python

like image 157
Morye Avatar answered Sep 07 '25 20:09

Morye


Late answer, but maybe usefull.

I encountered a similar issue :

OSError: [Errno 28] No space left on device:

But, I have enough space:

$ df -h
Sys. de fichiers          Taille Utilisé Dispo Uti% Monté sur
/dev/dm-0                   5,6G    3,2G  2,1G  62% /
udev                         10M       0   10M   0% /dev
tmpfs                       4,8G    481M  4,3G  10% /run
tmpfs                        12G    8,0K   12G   1% /dev/shm
tmpfs                       5,0M       0  5,0M   0% /run/lock
tmpfs                        12G       0   12G   0% /sys/fs/cgroup
tmp                         945M     23M  858M   3% /tmp
var                         5,6G    3,3G  2,0G  64% /var
data                         20G     11G  8,6G  56% /data

In fact, it's not a weight problem, it is an amount problem.

The evidence:

$ df -hi
Sys. de fichiers          Inœuds IUtil. ILibre IUti% Monté sur
/dev/dm-0                   367K   307K    61K   84% /
udev                        3,0M    365   3,0M    1% /dev
tmpfs                       3,0M    597   3,0M    1% /run
tmpfs                       3,0M      2   3,0M    1% /dev/shm
tmpfs                       3,0M      9   3,0M    1% /run/lock
tmpfs                       3,0M     13   3,0M    1% /sys/fs/cgroup
tmp                          61K   5,1K    56K    9% /tmp
var                         367K    95K   273K   26% /var
data                        1,3M   1,3M      0  100% /data

There is no more place for inodes (files).

And this is clearly due to the session management:

$ du --max-depth=1 --inodes -h /data/my-python-program/data/
1,2M    /data/base-eelv/data/sessions
178 /data/base-eelv/data/medias

The quick fix is to empty the session directory.

The clean fix is to auto-cleanup, but at this time, I have'nt search how to do this.

like image 37
Bastien Ho Avatar answered Sep 07 '25 21:09

Bastien Ho