Files
flux1-edit/install_dependencies.bat

123 lines
3.1 KiB
Batchfile
Raw Normal View History

2025-08-26 02:35:44 +09:00
@echo off
echo Installing FLUX.1 Edit MCP Server Dependencies...
echo ===============================================
REM Check if Python is available
python --version >nul 2>&1
if errorlevel 1 (
echo Error: Python is not installed or not in PATH
echo Please install Python 3.8 or higher from https://python.org
pause
exit /b 1
)
echo Python version:
python --version
echo.
REM Check if pip is available
pip --version >nul 2>&1
if errorlevel 1 (
echo Error: pip is not available
echo Please ensure pip is installed with Python
pause
exit /b 1
)
REM Update pip to latest version
echo Updating pip...
python -m pip install --upgrade pip
if errorlevel 1 (
echo Warning: Failed to upgrade pip, continuing with current version
)
REM Check if virtual environment exists, create if not
if not exist "venv" (
echo Creating virtual environment...
python -m venv venv
if errorlevel 1 (
echo Error: Failed to create virtual environment
echo This might be due to permissions or Python installation issues
pause
exit /b 1
)
echo Virtual environment created successfully.
) else (
echo Virtual environment already exists.
)
REM Activate virtual environment
echo Activating virtual environment...
call venv\Scripts\activate.bat
if errorlevel 1 (
echo Error: Failed to activate virtual environment
echo Trying to recreate virtual environment...
rmdir /s /q venv
python -m venv venv
call venv\Scripts\activate.bat
if errorlevel 1 (
echo Error: Still failed to activate virtual environment
pause
exit /b 1
)
)
echo Virtual environment activated.
echo Current Python location:
where python
echo.
REM Install dependencies with explicit error handling
echo Installing dependencies from requirements.txt...
pip install -r requirements.txt --no-cache-dir -v
if errorlevel 1 (
echo Error: Failed to install some dependencies
echo Trying to install critical dependencies individually...
echo.
echo Installing aiohttp...
pip install aiohttp==3.11.7
echo Installing httpx...
pip install httpx==0.28.1
echo Installing mcp...
pip install mcp==1.1.0
echo Installing Pillow...
pip install Pillow==11.0.0
echo Installing python-dotenv...
pip install python-dotenv==1.0.1
echo Installing pydantic...
pip install pydantic==2.10.3
echo Installing structlog...
pip install structlog==24.4.0
)
echo.
echo Verifying installations...
python -c "import aiohttp; print(f'aiohttp version: {aiohttp.__version__}')" 2>nul
if errorlevel 1 (
echo Error: aiohttp is not properly installed
echo Trying alternative installation method...
pip install --force-reinstall aiohttp
)
python -c "import mcp; print('mcp module imported successfully')" 2>nul
if errorlevel 1 (
echo Warning: mcp module check failed, but this might be normal
)
echo.
echo Installation completed!
echo.
echo Next steps:
echo 1. Copy .env.example to .env: copy .env.example .env
echo 2. Edit .env file and add your FLUX_API_KEY
echo 3. Run the server with: run.bat or python main.py
echo.
pause