This document explains the technical details of dependency structure for transcript-create.
📚 For comprehensive dependency management guidelines, see: Development > Dependencies Guide
The detailed guide covers:
- Adding and updating dependencies
- Security patch handling with SLA
- Automated updates with Dependabot
- Version policy and testing strategies
- Troubleshooting common issues
- requirements.txt: Primary dependencies with pinned versions
- constraints.txt: Full dependency tree for reproducible builds
- Dockerfile: Special handling for PyTorch with ROCm/CUDA support
All production dependencies are explicitly pinned to specific versions:
- API Framework: FastAPI, Uvicorn
- Database: SQLAlchemy, psycopg
- Media Processing: yt-dlp
- Transcription: faster-whisper, openai-whisper
- Diarization: pyannote.audio (optional)
- Auth: Authlib
- Billing: stripe
- Export: reportlab
Contains all transitive dependencies with exact versions for:
- Reproducible builds across environments
- Security auditing
- Compatibility verification
PyTorch and related packages (torch, torchaudio) have different builds for:
- CUDA: NVIDIA GPUs
- ROCm: AMD GPUs
- CPU: No GPU acceleration
These cannot coexist and must be installed separately based on the target hardware.
The Dockerfile implements a two-stage installation:
-
Install general dependencies from requirements.txt
pip3 install -r requirements.txt
-
Remove any conflicting torch packages that may have been installed as transitive dependencies
pip3 uninstall -y torch torchvision torchaudio
-
Install ROCm-specific PyTorch from the appropriate wheel index
pip3 install --index-url ${ROCM_WHEEL_INDEX} \ torch==2.4.1+rocm6.0 torchaudio==2.4.1+rocm6.0
ROCM_WHEEL_INDEX: URL to PyTorch wheels for specific ROCm version- Default:
https://download.pytorch.org/whl/rocm6.0 - ROCm 6.1:
https://download.pytorch.org/whl/rocm6.1 - ROCm 6.2:
https://download.pytorch.org/whl/rocm6.2
- Default:
Example for different ROCm version:
docker compose build --build-arg ROCM_WHEEL_INDEX=https://download.pytorch.org/whl/rocm6.1To use NVIDIA GPUs instead:
-
Change base image in Dockerfile:
FROM nvidia/cuda:12.8.0-cudnn8-runtime-ubuntu22.04 -
Change PyTorch installation:
pip3 install --index-url https://download.pytorch.org/whl/cu124 \ torch==2.4.1+cu124 torchaudio==2.4.1+cu124 -
Update docker-compose.yml to use nvidia runtime
For development without GPU:
pip3 install torch==2.4.1 torchaudio==2.4.1Set in .env:
FORCE_GPU=false-
Check for vulnerabilities:
pip-audit -r requirements.txt safety check -r requirements.txt
-
Update specific package:
pip install --upgrade package-name==NEW_VERSION pip freeze | grep package-name -
Test thoroughly in development
-
Update both requirements.txt and constraints.txt:
# In a clean virtual environment pip install -r requirements.txt pip freeze > constraints.txt
-
Run security scans again to verify
When updating to new major versions:
- Review changelog and breaking changes
- Update in a development branch
- Run full test suite
- Check compatibility with ROCm/CUDA versions
- Update documentation if needed
GitHub Actions automatically runs security scans:
- On push to main/develop branches
- On pull requests
- Weekly schedule (Mondays at 9 AM UTC)
- Manual trigger via workflow_dispatch
Scans fail on high/critical severity vulnerabilities.
The constraints.txt file captures the complete resolved dependency tree. This provides:
- Reproducibility: Exact versions for all dependencies
- Security: Complete audit trail of all packages
- Debugging: Easy to identify which transitive dependency changed
Update constraints.txt when:
- Adding new dependencies to requirements.txt
- Updating existing dependency versions
- After security updates
- Before major releases
# Create clean virtual environment
python3 -m venv /tmp/venv-constraints
source /tmp/venv-constraints/bin/activate
# Install requirements
pip install --upgrade pip
pip install -r requirements.txt
# Generate constraints (excluding GPU packages)
pip freeze > constraints.txt
# Manually remove or comment nvidia-* packages if present
# These conflict with ROCm builds- PyTorch 2.4.x requires numpy < 2.4
- pyannote.audio has specific numpy version requirements
- Current pinned versions are tested and compatible
- Tested on Python 3.12
- Some dependencies (numba, llvmlite) may have version-specific wheels
- Use Python 3.12 in production for best compatibility
- Base image:
rocm/dev-ubuntu-22.04:6.0.2 - PyTorch ROCm wheels: version must match base image
- Verify compatibility: https://pytorch.org/get-started/locally/
If you see import errors after dependency updates:
pip check # Check for conflicts
pip list --outdated # Check for outdated packages
pip install --force-reinstall -r requirements.txtIf GPU is not detected:
# Inside container
python3 -c "import torch; print(torch.cuda.is_available())"
python3 -c "import torch; print(torch.version.hip)"Expected output for ROCm:
cuda.is_available(): Trueversion.hip: "6.0" or similar
If Docker build fails on PyTorch installation:
- Check ROCM_WHEEL_INDEX URL is accessible
- Verify PyTorch version is available for your ROCm version
- Try a different ROCm version or PyTorch version
- Check for wheel compatibility with Python version
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt
# For CPU-only torch
pip uninstall -y torch torchaudio
pip install torch==2.4.1 torchaudio==2.4.1# Build with current dependencies
docker compose build
# Rebuild specific service
docker compose build worker
# Force rebuild without cache
docker compose build --no-cache api worker- PyTorch Installation: https://pytorch.org/get-started/locally/
- ROCm Documentation: https://rocm.docs.amd.com/
- pip-audit: https://github.com/pypa/pip-audit
- Safety: https://github.com/pyupio/safety
- Gitleaks: https://github.com/gitleaks/gitleaks
For dependency-related issues:
- Check this document first
- Review Dockerfile for GPU installation logic
- Check GitHub Issues for similar problems
- Open a new issue with dependency versions and error output