Chatterbox-TTS-Server icon indicating copy to clipboard operation
Chatterbox-TTS-Server copied to clipboard

Apple Silicon instructions are broken

Open AlexanderHanff opened this issue 1 year ago • 2 comments

This will not install on Apple Silicon, Onnx fails to build every single time - I even tried in python 3.10 venv and it would not build, fails to create wheel.

AlexanderHanff avatar Jul 22 '25 08:07 AlexanderHanff

I've got it working on M1 Mac Mini. The requirements.txt doesn't list the right order to install the dependencies. I used Grok to help sort that out for me.

appsteve avatar Aug 06 '25 04:08 appsteve

My AI had to update the requirements.txt a bit, I'll include a guide and the new requirements.txt it provided below:

Here is how you can present the updated Apple Silicon (Mac) instructions in your documentation, along with the requested blurb explaining the technical debt you fixed.

Should fall withinREADME.md under a macOS/Apple Silicon section.


🍎 macOS / Apple Silicon (M1/M2/M3) Installation

If you are running on a Mac with Apple Silicon, do not use the ROCm or CUDA installation scripts. The standard PyTorch installation for macOS automatically utilizes Apple's MPS (Metal Performance Shaders) for hardware acceleration.

Use the base requirements.txt which has been specifically optimized for CPU and Mac compatibility.

1. Create and activate a virtual environment

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip

2. Install standard dependencies

pip install -r requirements.txt

(Note: You can safely ignore any red warnings from pip at the end of this step regarding descript-audiotools and protobuf. This is an expected side effect of the version pinning.)

3. Install Chatterbox & Models Because of complex sub-dependency conflicts, Chatterbox and its tokenizers must be installed with --no-deps to ensure they use the packages we just configured.

pip install --no-deps git+https://github.com/devnen/chatterbox-v2.git@master s3tokenizer==0.3.0 onnx==1.16.0

4. Start the Server

python server.py

📝 Maintainer's Note: Why requirements.txt Was Updated

If you are transitioning from the original configuration, several silent dependency issues have been resolved in the updated requirements.txt:

  1. The Protobuf Import Crash: The original configuration relied on descript-audiotools, which requested protobuf < 3.20. However, onnx==1.16.0 strictly requires protobuf >= 3.20.2. Because onnx was installed using --no-deps, pip defaulted to protobuf 3.19.6. This caused a fatal runtime crash (ImportError: cannot import name 'builder') when onnx attempted to load. We solved this by strictly pinning protobuf>=3.20.2,<3.21.0, which perfectly satisfies onnx while acting as a stable bridge for the audio tools.
  2. Missing Internal Dependencies: The original setup's reliance on the --no-deps flag for the main application caused internal packages like gradio, pykakasi, pre-commit, and spacy-pkuseg to be completely skipped. We explicitly added these to requirements.txt to prevent runtime failures.
  3. Version Drifting: Unpinned versions of numpy (which drifted to 2.x) and safetensors (which drifted to 0.7.0) caused severe API incompatibilities with chatterbox-tts. These are now strictly bounded (numpy<1.26.0, safetensors==0.5.3) to guarantee a reproducible environment.

requirements.txt:


# ============================================================================
# CHATTERBOX TTS SERVER - REQUIREMENTS (CPU-ONLY INSTALLATION)
# ============================================================================
# This file ensures compatible PyTorch, ML, and audio processing libraries
# are installed for CPU-only operation.

# --- PyTorch CPU-Only Installation Index ---
--extra-index-url https://download.pytorch.org/whl/cpu

# --- Deep Learning Framework (CPU-Only) ---
torch==2.5.1
torchvision==0.20.1
torchaudio==2.5.1

# --- Core TTS Application ---
# IMPORTANT: chatterbox-tts is NOT included here. It must be installed
# separately with --no-deps to prevent dependency resolver conflicts
# (ONNX source builds, torch version mismatches).
#
# The start.py launcher handles this automatically.
#
# For manual installation, run these commands in order:
#   pip install -r requirements.txt
#   pip install --no-deps git+https://github.com/devnen/chatterbox-v2.git@master s3tokenizer==0.3.0 onnx==1.16.0

# --- Chatterbox Dependencies (explicit, since --no-deps skips them) ---
# NOTE: s3tokenizer and onnx are installed with --no-deps alongside chatterbox
# to avoid protobuf version conflicts (onnx requires protobuf>=3.20.2 but
# descript-audiotools requires protobuf<3.20).
conformer==0.3.2
diffusers==0.29.0
transformers==4.46.3
einops>=0.7.0
omegaconf==2.3.0
resampy==0.4.3
resemble-perth==1.0.1

# --- Web Framework & Server ---
fastapi>=0.100.0,<0.116.0       # starlette<1.0 needed for TemplateResponse compat
uvicorn[standard]>=0.27.0

# --- ML & Audio Libraries ---
numpy>=1.24.0,<1.26.0
librosa>=0.10.0
safetensors==0.5.3
descript-audio-codec==1.0.0
soundfile>=0.12.0
pydub>=0.25.0
audiotsm>=0.1.2
praat-parselmouth>=0.4.0

# --- Additional chatterbox-tts & s3tokenizer dependencies ---
gradio==5.44.1
pykakasi==2.3.0
spacy-pkuseg
pre-commit
protobuf>=3.20.2,<3.21.0

# --- Web & API Utilities ---
python-multipart>=0.0.5
requests>=2.28.0
Jinja2>=3.1.2,<3.2.0
aiofiles>=23.0.0
hf_transfer>=0.1.4

# --- Configuration & Data Processing ---
PyYAML>=6.0
watchdog>=3.0.0
unidecode>=1.3.0
inflect>=7.0.0
tqdm>=4.65.0

jsandroid avatar May 20 '26 19:05 jsandroid