Environment Setup
The easiest way to use Qwen3-TTS is to install theqwen-tts Python package from PyPI. We recommend using a fresh, isolated environment to avoid dependency conflicts with existing packages.
Recommended: Python 3.12 for optimal compatibility and performance.Supported versions: Python 3.9, 3.10, 3.11, 3.12, 3.13 (see pyproject.toml:13-17)
Create a Clean Environment
Create a new conda environment with Python 3.12:Installation Methods
- From PyPI (Recommended)
- From Source
Install the latest stable release from PyPI:This will automatically install all required dependencies:
transformers==4.57.3accelerate==1.12.0gradio,librosa,torchaudio,soundfile,soxonnxruntime,einops
FlashAttention 2 (Recommended)
We strongly recommend installing FlashAttention 2 to reduce GPU memory usage and improve inference speed.1
Standard Installation
For most systems:
2
For Limited RAM Systems
If your machine has less than 96GB of RAM and many CPU cores:This limits the number of parallel compilation jobs to prevent out-of-memory errors during installation.
Model Download
During model loading, weights are automatically downloaded based on the model name. However, if your runtime environment doesn’t support automatic downloads, you can manually download models to a local directory.- ModelScope (China)
- Hugging Face
Recommended for users in Mainland China:
When using locally downloaded models, pass the local directory path instead of the model name when loading:
System Requirements
Software
- Python 3.9 or later (3.12 recommended)
- PyTorch with CUDA support
- 96GB+ RAM (for FlashAttention 2 compilation)
Hardware
- NVIDIA GPU with CUDA support
- Compatible with FlashAttention 2 (Ampere or newer recommended)
- Sufficient VRAM for model size (varies by model)
Verify Installation
Test your installation by importing the package:Next Steps
Quickstart Guide
Generate your first speech with complete working examples