refactor: simplify UV setup script by removing environment variable settings and virtual environment checks

This commit is contained in:
Mister K 2025-05-02 23:48:08 +08:00
parent 5c08b23fa3
commit a176b07001

View File

@ -1,45 +1,14 @@
#!/bin/bash
# ComfyUI UV Environment Setup Script
# Created: May 2, 2025
# ComfyUI UV Setup Script
# Set UV environment variables for better performance
export UV_CACHE_DIR="${HOME}/.cache/uv"
export UV_SYSTEM_PYTHON=false
export UV_DEFAULT_PYTHON=3.11
export UV_THREADS=auto
export UV_VERBOSITY=1
# Create directory structure if needed
mkdir -p "${UV_CACHE_DIR}"
echo "UV environment variables set:"
echo " UV_CACHE_DIR: ${UV_CACHE_DIR}"
echo " UV_DEFAULT_PYTHON: ${UV_DEFAULT_PYTHON}"
echo " UV_THREADS: ${UV_THREADS}"
# Check if UV is installed
if ! command -v uv >/dev/null 2>&1; then
echo "UV not found. Installing..."
curl -LsSf https://astral.sh/uv/install.sh | sh
# Add to PATH for this session
source $HOME/.local/bin/env
# Check if Python is available
if ! command -v python3 &> /dev/null; then
echo "Python 3 is required but not found. Please install Python 3.9+ first."
exit 1
fi
# Check for ComfyUI virtual environment
if [ ! -d ".venv" ]; then
echo "Creating virtual environment..."
uv venv
echo "Virtual environment created at .venv"
fi
# Make Python script executable
chmod +x ./uv_setup.py
echo ""
echo "To activate the virtual environment, run:"
echo " source .venv/bin/activate # On Linux/macOS"
echo " .venv\\Scripts\\activate.bat # On Windows"
echo ""
echo "To install/update dependencies:"
echo " ./update_dependencies_uv.py --advanced --cuda --lock"
echo ""
echo "To start ComfyUI:"
echo " python main.py"
# Run the Python setup script with passed arguments
python3 ./uv_setup.py "$@"