Enhance setup scripts for TTS environment initialization

- Updated setup.ps1 and setup.sh to check for and install the 'uv' package manager if not already present.
- Modified virtual environment creation to use 'uv' for consistency across platforms.
- Improved activation instructions for the virtual environment in both scripts.
- Added FFmpeg installation for Windows and system dependencies for Linux and macOS to ensure all necessary tools are available for TTS functionality.
- Streamlined dependency installation process to utilize 'uv' for package management.
This commit is contained in:
Pierre Bruno
2025-01-24 20:02:11 +01:00
parent 1fc7602e1b
commit 23f0ffb7da
2 changed files with 49 additions and 22 deletions

View File

@@ -1,22 +1,32 @@
# Setup script for Windows # Setup script for Windows
Write-Host "Setting up Kokoro TTS Local..." Write-Host "Setting up Kokoro TTS Local..."
# Check if Python is installed # Check if uv is installed
if (!(Get-Command python -ErrorAction SilentlyContinue)) { $uvExists = Get-Command uv -ErrorAction SilentlyContinue
Write-Host "Error: Python is not installed. Please install Python 3.8 or higher." if (-not $uvExists) {
exit 1 Write-Host "Installing uv package manager..."
iwr -useb https://astral.sh/uv/install.ps1 | iex
} }
# Create and activate virtual environment # Create virtual environment if it doesn't exist
Write-Host "Creating virtual environment..." if (-not (Test-Path "venv")) {
python -m venv venv Write-Host "Creating virtual environment..."
.\venv\Scripts\Activate uv venv
}
# Upgrade pip # Activate virtual environment
python -m pip install --upgrade pip Write-Host "Activating virtual environment..."
.\venv\Scripts\Activate.ps1
# Install dependencies # Install dependencies using uv
Write-Host "Installing dependencies..." Write-Host "Installing dependencies..."
pip install -r requirements.txt uv pip install -r requirements.txt
Write-Host "Setup complete! You can now run: python tts_demo.py" # Install FFmpeg if not already installed (using winget)
$ffmpegExists = Get-Command ffmpeg -ErrorAction SilentlyContinue
if (-not $ffmpegExists) {
Write-Host "Installing FFmpeg..."
winget install -e --id Gyan.FFmpeg
}
Write-Host "Setup complete! Run '.\venv\Scripts\Activate.ps1' to activate the virtual environment."

View File

@@ -8,16 +8,33 @@ if ! command -v python3 &> /dev/null; then
exit 1 exit 1
fi fi
# Create and activate virtual environment # Install uv if not already installed
echo "Creating virtual environment..." if ! command -v uv &> /dev/null; then
python3 -m venv venv echo "Installing uv package manager..."
curl -LsSf https://astral.sh/uv/install.sh | sh
fi
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
uv venv
fi
# Activate virtual environment
source venv/bin/activate source venv/bin/activate
# Upgrade pip # Install dependencies using uv
python -m pip install --upgrade pip
# Install dependencies
echo "Installing dependencies..." echo "Installing dependencies..."
pip install -r requirements.txt uv pip install -r requirements.txt
echo "Setup complete! You can now run: python tts_demo.py" # Install system dependencies if needed
if [ "$(uname)" == "Linux" ]; then
echo "Installing system dependencies..."
sudo apt-get update
sudo apt-get install -y espeak-ng ffmpeg
elif [ "$(uname)" == "Darwin" ]; then
echo "Installing system dependencies..."
brew install espeak-ng ffmpeg
fi
echo "Setup complete! Run 'source venv/bin/activate' to activate the virtual environment."