Skip to content

Instantly share code, notes, and snippets.

@zencd
Last active November 10, 2024 12:21
Show Gist options
  • Save zencd/0c7e0a3b0139fa75cf78b804566fa0db to your computer and use it in GitHub Desktop.
Save zencd/0c7e0a3b0139fa75cf78b804566fa0db to your computer and use it in GitHub Desktop.
Install demucs
#!/usr/bin/env bash
# install or upgrade demucs: a state-of-the-art music source separation tool
#
# works ok for: macos 14.7, brew 4.4.4, python 3.12, demucs 4.0.1
#
# links:
# https://github.com/facebookresearch/demucs - not maintained anymore
# https://github.com/adefossez/demucs - a fork by the same author
#
# Nov 2024: demucs can't be installed on python3.13: `lameenc` dep cannot be resolved bsr - using a lower version
#
# after the first start some binaries gonna be downloaded and stored under ~/.cache/torch/hub/checkpoints:
# https://dl.fbaipublicfiles.com/demucs/mdx_final/14fc6a69-a89dd0ee.th
# https://dl.fbaipublicfiles.com/demucs/mdx_final/464b36d7-e5a9386e.th
# https://dl.fbaipublicfiles.com/demucs/mdx_final/7fd6ef75-a905dd85.th
# https://dl.fbaipublicfiles.com/demucs/mdx_final/83fc094f-4a16d450.th
# https://dl.fbaipublicfiles.com/demucs/hybrid_transformer/955717e8-8726e21a.th
# etc
PYTHON_VERSION=3.12
VENV="$HOME/venv/demucs"
set -xe
brew install "python@$PYTHON_VERSION"
mkdir -p "$(dirname "$VENV")"
[ -d "$VENV" ] || "python$PYTHON_VERSION" -m venv "$VENV"
"$VENV/bin/pip" install --upgrade pip
# FATAL: Trying to use DiffQ, but diffq is not installed.
"$VENV/bin/pip" install diffq
# https://github.com/facebookresearch/demucs/issues/570
"$VENV/bin/pip" install soundfile
"$VENV/bin/pip" install --upgrade demucs
# a good pip freeze if the above will stop work once:
# "$VENV/bin/pip" install 'antlr4-python3-runtime==4.9.3' 'cffi==1.17.1' 'cloudpickle==3.1.0' 'Cython==3.0.11' 'diffq==0.2.4' 'dora_search==0.1.12' 'einops==0.8.0' 'filelock==3.16.1' 'fsspec==2024.10.0' 'Jinja2==3.1.4' 'julius==0.2.7' 'lameenc==1.7.0' 'MarkupSafe==3.0.2' 'mpmath==1.3.0' 'networkx==3.4.2' 'numpy==2.1.3' 'omegaconf==2.3.0' 'openunmix==1.3.0' 'pycparser==2.22' 'PyYAML==6.0.2' 'retrying==1.3.4' 'setuptools==75.3.0' 'six==1.16.0' 'soundfile==0.12.1' 'submitit==1.5.2' 'sympy==1.13.1' 'torch==2.5.1' 'torchaudio==2.5.1' 'tqdm==4.67.0' 'treetable==0.2.5' 'typing_extensions==4.12.2' 'demucs==4.0.1'
# how to use it
# ~/venv/demucs/bin/demucs -n mdx_extra_q 1.wav
# ~/venv/demucs/bin/demucs --two-stems=vocals 1.wav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment