fix(dev): add setup script for chatterbox-tts and hume-tada installation#543
fix(dev): add setup script for chatterbox-tts and hume-tada installation#543delta97 wants to merge 1 commit intojamiepine:mainfrom
Conversation
Local development was missing the `pip install --no-deps chatterbox-tts` and `pip install --no-deps hume-tada` steps that the Dockerfile includes. This caused "No module named 'chatterbox'" errors when trying to use the Chatterbox TTS model. - Add scripts/setup-backend.sh that mirrors the Dockerfile's Python setup - Update requirements.txt comments to document the manual install commands Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe changes update installation guidance in requirements documentation and introduce a new bash setup script to automate backend dependency installation while handling packages with incompatible pinned dependencies using the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
scripts/setup-backend.sh (3)
13-13: Consider usingpython -m pipfor better portability.Using
python -m pipinstead of the barepipcommand ensures the package manager matches the active Python interpreter, which is more reliable in environments with multiple Python versions.♻️ Proposed fix
-pip install -r "$PROJECT_DIR/backend/requirements.txt" +python -m pip install -r "$PROJECT_DIR/backend/requirements.txt"Apply the same change to lines 17-18:
-pip install --no-deps chatterbox-tts -pip install --no-deps hume-tada +python -m pip install --no-deps chatterbox-tts +python -m pip install --no-deps hume-tada🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/setup-backend.sh` at line 13, Replace bare pip invocations in the setup script with the interpreter-bound form to ensure the pip used matches the active Python: change the pip install lines (the call currently shown as "pip install -r \"$PROJECT_DIR/backend/requirements.txt\"") to use "python -m pip" and apply the same replacement to the other pip lines around that block (the other pip install commands referenced on lines 17–18) so all package installs use the active Python interpreter's pip.
17-18: Consider pinning versions for chatterbox-tts and hume-tada.While the
--no-depsapproach correctly avoids dependency conflicts, installing these packages without version pins could lead to unexpected breakage if their APIs change in future releases. Consider adding version constraints to ensure reproducible builds.♻️ Suggested approach
First, determine the current working versions, then pin them:
-pip install --no-deps chatterbox-tts -pip install --no-deps hume-tada +python -m pip install --no-deps chatterbox-tts==<version> +python -m pip install --no-deps hume-tada==<version>You may also want to add corresponding comments in
requirements.txtto document the pinned versions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/setup-backend.sh` around lines 17 - 18, Pin the package versions for the two installs to ensure reproducible builds: replace the existing pip install commands (the lines installing "chatterbox-tts" and "hume-tada") with version-pinned installs (e.g., chatterbox-tts==<current-version> and hume-tada==<current-version>) after determining the current working versions, and add matching comments or entries in requirements.txt documenting those pinned versions and why --no-deps is used; update the two pip install invocations in scripts/setup-backend.sh and add corresponding notes in requirements.txt.
5-20: Optional: Add virtual environment check and better user feedback.The script could benefit from checking that it's running in a virtual environment to prevent accidentally polluting the system Python installation. Additionally, providing more detailed progress messages would improve the user experience.
💡 Example enhancements
set -e +# Check if running in a virtual environment +if [[ -z "${VIRTUAL_ENV}" ]]; then + echo "Warning: Not running in a virtual environment." + echo "Consider creating one with: python -m venv venv && source venv/bin/activate" + read -p "Continue anyway? (y/N) " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" -echo "Installing backend dependencies..." +echo "==> Installing backend dependencies..." # Install main requirements -pip install -r "$PROJECT_DIR/backend/requirements.txt" +echo "==> Installing requirements from requirements.txt..." +python -m pip install -r "$PROJECT_DIR/backend/requirements.txt" # Install packages that need --no-deps due to incompatible pinned versions # (See comments in requirements.txt for details) -pip install --no-deps chatterbox-tts -pip install --no-deps hume-tada +echo "==> Installing chatterbox-tts (--no-deps)..." +python -m pip install --no-deps chatterbox-tts +echo "==> Installing hume-tada (--no-deps)..." +python -m pip install --no-deps hume-tada -echo "Backend setup complete!" +echo "==> Backend setup complete!"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/setup-backend.sh` around lines 5 - 20, Add a virtual environment check at the top of the script by testing common indicators (e.g., the VIRTUAL_ENV environment variable or comparing "$(python -c 'import sys; print(sys.prefix)')" to system prefixes) and exit with a clear message if no venv is active; then add concise progress/log messages around key steps (e.g., "Checking virtualenv...", "Installing backend dependencies from $PROJECT_DIR/backend/requirements.txt", "Installing chatterbox-tts (no deps)", "Installing hume-tada (no deps)", "Backend setup complete") to improve user feedback; update references in the script to use the existing SCRIPT_DIR and PROJECT_DIR variables when composing messages.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@backend/requirements.txt`:
- Around line 24-27: Update the chatterbox-tts explanatory comment to reflect
the correct conditional dependency pins and Python version thresholds: replace
the outdated "numpy<1.26 / torch==2.6 which conflict with Python 3.12+" text
with a concise note that chatterbox-tts v0.1.7 pins numpy>=1.24.0,<2.0.0 for
Python <3.13 and numpy>=2.0.0 for Python >=3.13, and pins torch==2.6.0 for
Python <3.14 and torch>=2.9.0 for Python >=3.14, and state that conflicts occur
starting at Python 3.13 (numpy) and Python 3.14 (torch); keep the surrounding
guidance about installing chatterbox-tts with --no-deps intact.
---
Nitpick comments:
In `@scripts/setup-backend.sh`:
- Line 13: Replace bare pip invocations in the setup script with the
interpreter-bound form to ensure the pip used matches the active Python: change
the pip install lines (the call currently shown as "pip install -r
\"$PROJECT_DIR/backend/requirements.txt\"") to use "python -m pip" and apply the
same replacement to the other pip lines around that block (the other pip install
commands referenced on lines 17–18) so all package installs use the active
Python interpreter's pip.
- Around line 17-18: Pin the package versions for the two installs to ensure
reproducible builds: replace the existing pip install commands (the lines
installing "chatterbox-tts" and "hume-tada") with version-pinned installs (e.g.,
chatterbox-tts==<current-version> and hume-tada==<current-version>) after
determining the current working versions, and add matching comments or entries
in requirements.txt documenting those pinned versions and why --no-deps is used;
update the two pip install invocations in scripts/setup-backend.sh and add
corresponding notes in requirements.txt.
- Around line 5-20: Add a virtual environment check at the top of the script by
testing common indicators (e.g., the VIRTUAL_ENV environment variable or
comparing "$(python -c 'import sys; print(sys.prefix)')" to system prefixes) and
exit with a clear message if no venv is active; then add concise progress/log
messages around key steps (e.g., "Checking virtualenv...", "Installing backend
dependencies from $PROJECT_DIR/backend/requirements.txt", "Installing
chatterbox-tts (no deps)", "Installing hume-tada (no deps)", "Backend setup
complete") to improve user feedback; update references in the script to use the
existing SCRIPT_DIR and PROJECT_DIR variables when composing messages.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7a1ec75e-719b-4ee3-a498-e607f31e1688
📒 Files selected for processing (2)
backend/requirements.txtscripts/setup-backend.sh
| # Chatterbox TTS sub-dependencies (chatterbox-tts itself must be installed | ||
| # with --no-deps — run scripts/setup-backend.sh or: | ||
| # pip install --no-deps chatterbox-tts | ||
| # It pins numpy<1.26 / torch==2.6 which conflict with Python 3.12+) |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
What are the exact dependency version pins in the chatterbox-tts Python package, specifically for numpy and torch?
💡 Result:
The chatterbox-tts Python package (latest version 0.1.7) specifies conditional dependency version pins for numpy and torch in its pyproject.toml file to support different Python versions: For numpy: - numpy>=1.24.0,<2.0.0 when python_version < '3.13' - numpy>=2.0.0 when python_version >= '3.13' For torch (and torchaudio): - torch==2.6.0 and torchaudio==2.6.0 when python_version < '3.14' - torch>=2.9.0 and torchaudio>=2.9.0 when python_version >= '3.14' These are not exact single-version pins but ranges and exact versions conditioned on the Python version for compatibility (e.g., wheel availability). Older versions had stricter pins like numpy==1.26.0 or <1.26.0,>=1.24.0, but the current master/main branch reflects the above.
Citations:
- 1: https://github.com/resemble-ai/chatterbox/blob/master/pyproject.toml
- 2: https://pypi.org/project/chatterbox-tts/
- 3: Cannot pip install chatterbox 'numpy' resemble-ai/chatterbox#427
- 4: Not able to istall " chatterbox-tts 0.1.1 depends on numpy==1.26.0" resemble-ai/chatterbox#104
Update the chatterbox-tts comment with accurate dependency version constraints.
The documented version constraints are outdated. Chatterbox-tts v0.1.7 uses conditional pins based on Python version: numpy>=1.24.0,<2.0.0 (Python < 3.13), numpy>=2.0.0 (Python >= 3.13), torch==2.6.0 (Python < 3.14), and torch>=2.9.0 (Python >= 3.14). The conflict is with Python 3.13+ for numpy and Python 3.14+ for torch, not Python 3.12+. Update the comment to reflect these conditional constraints and correct Python version thresholds.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@backend/requirements.txt` around lines 24 - 27, Update the chatterbox-tts
explanatory comment to reflect the correct conditional dependency pins and
Python version thresholds: replace the outdated "numpy<1.26 / torch==2.6 which
conflict with Python 3.12+" text with a concise note that chatterbox-tts v0.1.7
pins numpy>=1.24.0,<2.0.0 for Python <3.13 and numpy>=2.0.0 for Python >=3.13,
and pins torch==2.6.0 for Python <3.14 and torch>=2.9.0 for Python >=3.14, and
state that conflicts occur starting at Python 3.13 (numpy) and Python 3.14
(torch); keep the surrounding guidance about installing chatterbox-tts with
--no-deps intact.
Summary
scripts/setup-backend.shthat mirrors the Dockerfile's Python setup for local developmentrequirements.txtcomments to document the manual--no-depsinstall commandsProblem
Local development was missing the
pip install --no-deps chatterbox-ttsandpip install --no-deps hume-tadasteps that the Dockerfile includes (lines 38-39). This causedModuleNotFoundError: No module named 'chatterbox'errors when trying to use the Chatterbox TTS model.The
--no-depsflag is required because these packages pin incompatible versions:chatterbox-tts: pinsnumpy<1.26,torch==2.6.0,transformers==4.46.3hume-tada: pinstorch>=2.7,<2.8Test plan
./scripts/setup-backend.shin a fresh venvpython -c "import chatterbox"succeeds🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
scripts/setup-backend.sh) to streamline backend installation and dependency resolution for TTS packages.Documentation