Repository navigation
CI Error "OSError: [Errno 28] No space left on device" #8838
Description
Describe the bug
On occasion CI jobs will fail with this error, often caused by pip downloading huge CUDA packages. This is partly addressed with recent commits but needs to be fully fixed in conjunction with #8561.
Copilot output from one example fail:
The job is failing because the runner disk fills up while pip is trying to create an isolated build environment and pull in large CUDA-related wheels as build dependencies:
- Failure point (from logs): during “Installing build dependencies” for
pip install -e .(withBUILD_MONAI=1), pip errors with
OSError: [Errno 28] No space left on device - The downloaded build deps include multiple large
nvidia-*cu12packages, which is what typically blows the GitHub-hosted runner disk.
Fix: stop pip from pulling CUDA build deps (use CPU-only build deps) and/or avoid build isolation during the compiled install
1) Ensure the compiled install uses --no-build-isolation
In .github/workflows/pythonapp.yml, the “Run compiled” step currently does:
- name: Run compiled (${{ runner.os }})
run: |
python -m pip uninstall -y monai
BUILD_MONAI=1 python -m pip install -e . # compile the cpp extensions
shell: bashChange it to:
- name: Run compiled (${{ runner.os }})
run: |
python -m pip uninstall -y monai
# avoid creating an isolated env that may pull huge CUDA build deps
BUILD_MONAI=1 python -m pip install --no-build-isolation -e .
shell: bashWhy this helps: build isolation forces pip to resolve and install whatever is listed in pyproject.toml’s build-system requirements into a temporary env. If that includes (directly or indirectly) CUDA-enabled Torch dependencies, the runner can run out of space.
2) Pin the build dependency Torch to CPU wheels in pyproject.toml (recommended)
If MONAI’s pyproject.toml build-system requires torch (common for extension builds), ensure it resolves to CPU wheels on CI by either:
- removing
torchfrombuild-system.requiresif it’s not strictly necessary at build time, or - constraining it so it doesn’t drag CUDA packages.
Concretely, in pyproject.toml under:
[build-system]
requires = [ ... ]Prefer a minimal set (example):
[build-system]
requires = ["setuptools", "wheel", "pybind11"]
build-backend = "setuptools.build_meta"If torch must remain there for compilation logic, then the workflow should install the CPU torch first (you already do), and you should rely on --no-build-isolation (Fix #1) so the build uses that already-installed CPU torch instead of re-resolving a potentially CUDA variant.
3) Add a quick disk cleanup before the compiled install (optional, but useful)
You already clean /opt/hostedtoolcache in some jobs/steps; add similar cleanup right before compiling on Linux to maximize free space:
- if: runner.os == 'Linux'
name: Free disk space (Linux only)
run: |
df -h
sudo rm -rf /opt/hostedtoolcache/CodeQL || true
sudo rm -rf /opt/hostedtoolcache/go || true
sudo rm -rf /opt/hostedtoolcache/Java* || true
sudo rm -rf /opt/hostedtoolcache/Ruby* || true
df -h
shell: bashMinimal change that should unblock PRs
If you want the smallest, highest-signal fix: apply Fix #1 (add --no-build-isolation to the compiled install step). That directly targets the failing phase shown in the logs (“Installing build dependencies”) and typically prevents pip from downloading the large nvidia-*cu12 wheels that exhaust disk space.
Activity
iloveme81189-del commentedon May 4, 2026
CI/CD cache needs to be checked and GET the FORCED reset once and remove the PYCHACHE
liuminsheng3 commentedon Jun 15, 2026
The
--no-build-isolationchange suggested in the issue body is the right first fix for this failure mode. When pip creates the isolated build env, the largenvidia-*cu12wheels can land in pip/build temp storage before the actual editable install even starts, so the disk spike is easy to miss if you only inspect the final workspace size.For one rerun, I would capture disk state immediately before
BUILD_MONAI=1 python -m pip install ...and after any cleanup step:If the spike is under pip cache/temp, a good CI shape is:
python -m pip install --no-build-isolation -e .plus, if needed for Linux compiled jobs only:
I maintain a read-only CI runner storage scan/checklist for exactly these runner disk-full cases. It does not delete anything; it just gives a text artifact with filesystem, temp, workspace, cache, Docker, and tool-cache sizes so the cleanup can stay targeted:
https://www.getsafedisks.com/ci-runner-no-space-left-on-device.html?utm_source=github&utm_medium=issue-comment&utm_campaign=ci-runner-disk-full&utm_term=monai-pip-cuda-build-isolation&utm_content=monai-8838
If useful, I also do a $29 CI incident triage from the failing log plus one scan artifact:
https://www.getsafedisks.com/checkout.html?product=pilot_audit&utm_source=github&utm_medium=issue-comment&utm_campaign=ci-runner-disk-full&utm_term=monai-pip-cuda-build-isolation&utm_content=monai-8838