Python: how to fix error: OSError: [Errno 28] No space left on device


No space left on device

Example error:

[root@s126368 BASNet-http]# pip3 install torch==0.4.1
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting torch==0.4.1
  Using cached https://files.pythonhosted.org/packages/49/0e/e382bcf1a6ae8225f50b99cc26effa2d4cc6d66975ccf3fa9590efcbedce/torch-0.4.1-cp36-cp36m-manylinux1_x86_64.whl
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 346, in run
    requirement_set.prepare_files(finder)
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 381, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 623, in _prepare_file
    session=self.session, hashes=hashes)
  File "/usr/lib/python3.6/site-packages/pip/download.py", line 821, in unpack_url
    hashes=hashes
  File "/usr/lib/python3.6/site-packages/pip/download.py", line 663, in unpack_http_url
    unpack_file(from_path, location, content_type, link)
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 609, in unpack_file
    flatten=not filename.endswith('.whl')
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 511, in unzip_file
    fp.write(data)
OSError: [Errno 28] No space left on device

Fix: change TMPDIR

[root@tutorialspots BASNet-http]# export TMPDIR="/mnt/store/tmp"

Done! Now all things are normal:

[root@tutorialspots BASNet-http]# pip3 install torch==0.4.1
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting torch==0.4.1
  Using cached https://files.pythonhosted.org/packages/49/0e/e382bcf1a6ae8225f50b99cc26effa2d4cc6d66975ccf3fa9590efcbedce/torch-0.4.1-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: torch
Successfully installed torch-0.4.1

Leave a Reply