
The error “no space left on disk” occurred when attempting to install `torch` using `pip`. The issue was due to insufficient space in the `/tmp` partition, which is mounted separately as an LVM logical volume. Here’s a breakdown of what went wrong and how it can be resolved:
Issue Identified
– **Insufficient Space**: The `/tmp` directory only had 1.9GB of free space, which was not sufficient for the large temporary storage required by `torch`.
– **Alternate Storage**: Since `/tmp` is an LVM logical volume separate from the root partition, it does not have access to additional disk space on the root partition (`/`) that was available in other partitions like `/home`.
Solutions
1. **Use an Alternative Temporary Directory**
– You can instruct `pip` to use a different directory (e.g., your home directory) with sufficient space for temporary files:
“`bash
mkdir -p ~/tmp_pip
TMPDIR=~/tmp_pip pip install torch
“`
2. **Increase `/tmp` Size**
– If you prefer a permanent solution, resize the logical volume associated with `/tmp`:
“`bash
# Unmount /tmp if possible (or use a live environment)
sudo lvresize -L +5G /dev/mapper/cenahpc–vg-tmp
sudo resize2fs /dev/mapper/cenahpc–vg-tmp
“`
3. **Clean Up Temporary Files**
– Clear out old files from `/tmp`:
“`bash
sudo rm -rf /tmp/*
“`
– Clean package caches and system logs on `/var` to free up space:
“`bash
sudo apt-get clean
sudo journalctl –vacuum-time=3d
“`
Summary
Your disk is not actually full but rather that the `/tmp` partition has limited space. To resolve this, you can either change where `pip` stores temporary files or resize the logical volume for `/tmp`. This will allow for successful installation of large packages like `torch`.