Demucs Guide

Fixes

The problems people hit most, with the exact words you will see. Most entries come from public GitHub issues, and each one links to its issue so you can read the whole thread.

The virtual environment was not created successfully because ensurepip is not available

What you see
On Ubuntu or Debian, python3 -m venv demucs-env stops with this message and suggests apt install python3.12-venv.
Why
Ubuntu ships Python without the part that builds virtual environments.
Fix
sudo apt install python3-venv
Then run the venv line again.

The same command also pins Python with --python 3.12. On a Linux system with no Python, uv picks the newest one (3.15 on 2026-10-12), Demucs 4.1.0 will not install there, and the run ends with FileNotFoundError ... requirements_minimal.txt. We reproduced this in a bare Ubuntu 24.04 container and the pinned command wrote four stems. We have not tested Windows or macOS for this.

Found by us on 2026-10-12 on a fresh Ubuntu 24.04 (Python 3.12.3); with python3-venv installed, the Linux option B steps ran and wrote all four stems.

ModuleNotFoundError: No module named 'numpy'

What you see
The first run stops with a long error that ends in File ".../demucs/transformer.py", line 14, in <module> and ModuleNotFoundError: No module named 'numpy'.
Why
Demucs 4.1.0 as published on PyPI imports numpy but does not list it as a requirement. Its package file lists numpy only for Intel Macs. Older PyTorch pulled numpy in by itself; the current one does not.
Fix
Add numpy. With uv, put --with numpy in the command. With pip, install it next to Demucs.
uvx --python 3.12 --with numpy demucs "your-song.mp3"
pip install numpy

Found by us on 2026-10-12 on Linux (Python 3.11 and 3.12, CPU), with both uvx demucs and pip. With numpy added, both ran. The fix is already proposed upstream as pull request #13 (open since August 2026, not merged as of 2026-10-12). Once a release includes it, the extra --with numpy does no harm.

The install downloads gigabytes of GPU files on a computer with no GPU

What you see
Not an error. uvx demucs or a plain pip install demucs pulls about 20 nvidia-* packages and takes much longer than expected.
Why
On Linux the default PyTorch package comes with CUDA (NVIDIA GPU) support. The official Linux page says so.
Fix
Install the processor-only PyTorch first. Then install Demucs. pip sees PyTorch as already there.
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -U demucs
pip install numpy
We measured it on 2026-10-12: a plain pip install demucs downloaded about 3.0 GB and used 5.5 GB on disk. The processor-only path downloaded about 196 MB for PyTorch and used about 1 GB.

Source: our own Linux test on 2026-10-12 (demucs 4.1.0, Python 3.12; the plain install took 79 s and the processor-only install 19 s plus 4 s for Demucs, on a fast connection), and the official Linux page. Not from a GitHub issue.

Could not load file ... Maybe it is not a supported file format?

Update, 2026-10-12: with Demucs 4.1.0 mp3 files work without ffmpeg. We tested an mp3 on a machine with no ffmpeg and got four stems. This entry is history from older versions. ffmpeg is still needed for flac output and unusual formats.

What you saw (older versions)
Could not load file C:\Users\...\Song.mp3. Maybe it is not a supported file format? When trying to load using ffmpeg, got the following error: Ffmpeg is not installed.
Why
An older Demucs could not read the file itself, and ffmpeg, the program it falls back on, was not installed. In the thread, one person solved it on Linux (WSL) by installing ffmpeg with sudo apt-get install ffmpeg, after first treating ffmpeg as a Python package.
Fix
If you still see this, on an old version or an unusual format, install ffmpeg as a normal program, not with pip, then open a new terminal. The official README says ffmpeg is optional, and needed for flac output and for formats it cannot read itself.
sudo apt-get install ffmpeg     # Linux (Debian, Ubuntu)
brew install ffmpeg             # macOS
winget install ffmpeg           # Windows

Source: facebookresearch/demucs#228 (open, opened 2021-11; reported against older versions). Install commands from the official Linux, macOS and Windows pages.

RuntimeError: Couldn't find appropriate backend to handle uri

What you see
The separation runs to 100%, then a long error ends with this line while saving a wav file. Reported on an M1 Mac with Python 3.11.
Why
Commenters tied it to how torchaudio 2.1 and newer pick an audio backend. It was reported against old Demucs versions, so it may not happen on the current one.
Fixes people reported working
Add --mp3 to the command, which writes mp3 through other code. Or install the soundfile package (pip install soundfile). One commenter also had to remove the similarly named PySoundFile first. Others went back to torch 2.0.1, which only works on Python 3.11 or older.

Source: facebookresearch/demucs#570 (open, opened 2023-11). We have not reproduced this.

RuntimeError: CUDA out of memory

What you see
RuntimeError: CUDA out of memory. Tried to allocate ... GiB, usually on a long song and a graphics card.
Why
The card does not have enough memory for the settings. The official README says you need at least 3 GB on the card, and about 7 GB with the default settings.
Fix
Use shorter pieces with --segment. The README suggests 8 if you only have 3 GB, and says quality may be worse if the number is too small. It also notes the Hybrid Transformer models accept at most 7.8. Setting the variable PYTORCH_NO_CUDA_MEMORY_CACHING=1 also helps, but makes separation slower. If it still fails, add -d cpu to use the processor.
demucs --segment 8 "my song.mp3"
demucs -d cpu "my song.mp3"

Source: facebookresearch/demucs#231 (closed, 2021-11; the thread reports a memory fix, pull request #248), and the README section Memory requirements for GPU acceleration.

The computer runs out of RAM on a very long track

What you see
Memory use keeps growing with -d cpu on an hours-long file. The reporter saw about 7 GB for a one-hour file and more than 34 GB for four hours.
Why
A contributor in the thread estimated the need at roughly 7 GiB for one hour and 28 GiB for four hours with a single model, and the reporter accepted that it was not a bug. The graphics card memory fixes do not reduce this.
Fix
Split the long file into shorter files and run them one by one. Do not use -j with big files: the README says it multiplies the RAM use by the same amount.

Source: facebookresearch/demucs#498 (closed, 2023-05). The estimate is the contributor's, not an official figure.

AssertionError after setting --segment

What you see
With --segment=40 on a graphics card, some files fail with an AssertionError in hdemucs.py. Other files are fine.
Why
Not settled. The reporter found that a different --segment value could make a failing file work, and smaller values failed more often. The maintainer thought a bug in padding code was fixed in the repository version, but the reporter said it still happened.
Fix
Change the number, or leave --segment out. The README says the Hybrid Transformer models only support a segment of up to 7.8 seconds.

Source: facebookresearch/demucs#374 (open, opened 2022-09).

Demucs runs on the processor, not the graphics card

What you see
Separation is slow and the card shows no activity.
Why
It depends. In the thread, one person had Docker without GPU access (nvidia-smi failed inside the container), and another had left out the device flag. The official Windows page adds that the default PyTorch there is processor-only.
Fix
Name the device: demucs -d cuda "my song.mp3". In Docker, install the NVIDIA container toolkit, which solved it in the thread. On Windows with an NVIDIA card, the official page shows how to install the GPU build of PyTorch.

Source: facebookresearch/demucs#411 (closed, 2022-11), and the official Windows page.

No module named 'demucs.api'

What you see
The demucs command runs, but a Python script fails with No module named 'demucs.api'.
Why
A commenter explained that the api module arrived with version 4.1.0, which had not been published to PyPI when the issue was filed in 2023.
Fix
Update, then check the version you have. We installed 4.1.0 from PyPI on 2026-10-12.
pip install -U demucs
pip show demucs

Source: facebookresearch/demucs#577 (open, opened 2023-12), and the related #576 (closed). Skip the git-install workarounds in that thread: they predate the PyPI release.

Saving the stems fails or the files are cut short

What you see
An error while saving, and a truncated file in the output folder. In the report it happened with a long input file.
Why
The reporter's disk was almost full. Separated stems are big, so a long song needs a lot of free space.
Fix
Free up disk space, or write to another drive with -o, then run it again.

Source: facebookresearch/demucs#413 (closed, 2022-11).

Not here?

Read the page for your system in the official repo: Linux, macOS, Windows. The README asks you to read it before posting an issue. Older issues live on facebookresearch/demucs.