feat: modified scripts to use uv instead of pip for easier onboarding
This commit is contained in:
+26
-19
@@ -4,25 +4,18 @@ echo "Starting installation for Linux..."
|
||||
|
||||
set -e
|
||||
|
||||
if ! command -v python3.10 &> /dev/null; then
|
||||
echo "Error: Python 3.10 is not installed. Please install Python 3.10 and try again."
|
||||
echo "You can install it using: sudo apt-get install python3.10 python3.10-dev python3.10-venv"
|
||||
# Check if uv is installed
|
||||
if ! command -v uv &> /dev/null; then
|
||||
echo "Error: uv is not installed. Please install uv first."
|
||||
echo "You can install it using: curl -LsSf https://astral.sh/uv/install.sh | sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if pip3.10 is available
|
||||
if ! python3.10 -m pip --version &> /dev/null; then
|
||||
echo "Error: pip for Python 3.10 is not installed. Installing python3.10-pip..."
|
||||
sudo apt-get install -y python3.10-pip || { echo "Failed to install python3.10-pip"; exit 1; }
|
||||
fi
|
||||
|
||||
# Update package list
|
||||
sudo apt-get update || { echo "Failed to update package list"; exit 1; }
|
||||
# make sure essential tool are installed
|
||||
sudo apt-get install -y \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
python3-wheel \
|
||||
build-essential \
|
||||
alsa-utils \
|
||||
portaudio19-dev \
|
||||
@@ -33,15 +26,29 @@ sudo apt-get install -y \
|
||||
libnss3 \
|
||||
libxss1 || { echo "Failed to install packages"; exit 1; }
|
||||
|
||||
# Upgrade pip for Python 3.10
|
||||
python3.10 -m pip install --upgrade pip || { echo "Failed to upgrade pip"; exit 1; }
|
||||
# Install and upgrade setuptools and wheel
|
||||
python3.10 -m pip install --upgrade setuptools wheel || { echo "Failed to install setuptools and wheel"; exit 1; }
|
||||
# Install Selenium for chromedriver
|
||||
python3.10 -m pip install selenium || { echo "Failed to install selenium"; exit 1; }
|
||||
# Install Python dependencies from requirements.txt
|
||||
python3.10 -m pip install -r requirements.txt --no-cache-dir || { echo "Failed to install requirements.txt"; exit 1; }
|
||||
# Initialize uv project if pyproject.toml doesn't exist
|
||||
if [ ! -f "pyproject.toml" ]; then
|
||||
echo "Initializing uv project..."
|
||||
uv init --python 3.10 || { echo "Failed to initialize uv project"; exit 1; }
|
||||
fi
|
||||
|
||||
# Sync the project (creates venv and installs dependencies)
|
||||
echo "Setting up Python environment with uv..."
|
||||
uv sync --python 3.10 || { echo "Failed to sync uv project"; exit 1; }
|
||||
|
||||
# Add specific packages
|
||||
echo "Adding Selenium..."
|
||||
uv add selenium || { echo "Failed to add selenium"; exit 1; }
|
||||
|
||||
# Add dependencies from requirements.txt if it exists
|
||||
if [ -f "requirements.txt" ]; then
|
||||
echo "Adding dependencies from requirements.txt..."
|
||||
uv add -r requirements.txt || { echo "Failed to add requirements from requirements.txt"; exit 1; }
|
||||
fi
|
||||
|
||||
# install docker compose
|
||||
sudo apt install -y docker-compose
|
||||
|
||||
echo "Installation complete for Linux!"
|
||||
echo "To activate the environment, run: source .venv/bin/activate"
|
||||
echo "Or run commands with: uv run <command>"
|
||||
+25
-17
@@ -4,18 +4,13 @@ echo "Starting installation for macOS..."
|
||||
|
||||
set -e
|
||||
|
||||
if ! command -v python3.10 &> /dev/null; then
|
||||
echo "Error: Python 3.10 is not installed. Please install Python 3.10 and try again."
|
||||
echo "You can install it using: sudo apt-get install python3.10 python3.10-dev python3.10-venv"
|
||||
# Check if uv is installed
|
||||
if ! command -v uv &> /dev/null; then
|
||||
echo "Error: uv is not installed. Please install uv first."
|
||||
echo "You can install it using: curl -LsSf https://astral.sh/uv/install.sh | sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if pip3.10 is available
|
||||
if ! python3.10 -m pip --version &> /dev/null; then
|
||||
echo "Error: pip for Python 3.10 is not installed. Installing python3.10-pip..."
|
||||
sudo apt-get install -y python3.10-pip || { echo "Failed to install python3.10-pip"; exit 1; }
|
||||
fi
|
||||
|
||||
# Check if homebrew is installed
|
||||
if ! command -v brew &> /dev/null; then
|
||||
echo "Homebrew not found. Installing Homebrew..."
|
||||
@@ -31,13 +26,26 @@ brew install --cask chromedriver
|
||||
# Install portaudio for pyAudio using Homebrew
|
||||
brew install portaudio
|
||||
|
||||
# Upgrade pip for Python 3.10
|
||||
python3.10 -m pip install --upgrade pip || { echo "Failed to upgrade pip"; exit 1; }
|
||||
# Install and upgrade setuptools and wheel
|
||||
python3.10 -m pip install --upgrade setuptools wheel || { echo "Failed to install setuptools and wheel"; exit 1; }
|
||||
# Install Selenium for chromedriver
|
||||
python3.10 -m pip install selenium || { echo "Failed to install selenium"; exit 1; }
|
||||
# Install Python dependencies from requirements.txt
|
||||
python3.10 -m pip install -r requirements.txt --no-cache-dir || { echo "Failed to install requirements.txt"; exit 1; }
|
||||
# Initialize uv project if pyproject.toml doesn't exist
|
||||
if [ ! -f "pyproject.toml" ]; then
|
||||
echo "Initializing uv project..."
|
||||
uv init --python 3.10 || { echo "Failed to initialize uv project"; exit 1; }
|
||||
fi
|
||||
|
||||
# Sync the project (creates venv and installs dependencies)
|
||||
echo "Setting up Python environment with uv..."
|
||||
uv sync --python 3.10 || { echo "Failed to sync uv project"; exit 1; }
|
||||
|
||||
# Add specific packages
|
||||
echo "Adding Selenium..."
|
||||
uv add selenium || { echo "Failed to add selenium"; exit 1; }
|
||||
|
||||
# Add dependencies from requirements.txt if it exists
|
||||
if [ -f "requirements.txt" ]; then
|
||||
echo "Adding dependencies from requirements.txt..."
|
||||
uv add -r requirements.txt || { echo "Failed to add requirements from requirements.txt"; exit 1; }
|
||||
fi
|
||||
|
||||
echo "Installation complete for macOS!"
|
||||
echo "To activate the environment, run: source .venv/bin/activate"
|
||||
echo "Or run commands with: uv run <command>"
|
||||
+60
-10
@@ -1,17 +1,67 @@
|
||||
@echo off
|
||||
echo Starting installation for Windows...
|
||||
|
||||
REM Install Python dependencies from requirements.txt
|
||||
pip install pyreadline3
|
||||
pip install -r requirements.txt
|
||||
REM Check if uv is installed
|
||||
uv --version >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo Error: uv is not installed. Please install uv first.
|
||||
echo You can install it using: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Install Selenium
|
||||
pip install selenium
|
||||
REM Initialize uv project if pyproject.toml doesn't exist
|
||||
if not exist "pyproject.toml" (
|
||||
echo Initializing uv project...
|
||||
uv init --python 3.10
|
||||
if %errorlevel% neq 0 (
|
||||
echo Failed to initialize uv project
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
REM Sync the project (creates venv and installs dependencies)
|
||||
echo Setting up Python environment with uv...
|
||||
uv sync --python 3.10
|
||||
if %errorlevel% neq 0 (
|
||||
echo Failed to sync uv project
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Add specific packages
|
||||
echo Adding pyreadline3...
|
||||
uv add pyreadline3
|
||||
if %errorlevel% neq 0 (
|
||||
echo Failed to add pyreadline3
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Adding Selenium...
|
||||
uv add selenium
|
||||
if %errorlevel% neq 0 (
|
||||
echo Failed to add selenium
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Add dependencies from requirements.txt if it exists
|
||||
if exist "requirements.txt" (
|
||||
echo Adding dependencies from requirements.txt...
|
||||
uv add -r requirements.txt
|
||||
if %errorlevel% neq 0 (
|
||||
echo Warning: Some packages from requirements.txt failed to install.
|
||||
)
|
||||
)
|
||||
|
||||
echo Installation complete for Windows!
|
||||
echo To activate the environment, run: .venv\Scripts\activate
|
||||
echo Or run commands with: uv run ^<command^>
|
||||
echo.
|
||||
echo Note: pyAudio installation may require additional steps on Windows.
|
||||
echo Please install portaudio manually (e.g., via vcpkg or prebuilt binaries) and then run: pip install pyaudio
|
||||
echo Also, download and install chromedriver manually from: https://sites.google.com/chromium.org/driver/getting-started
|
||||
echo Place chromedriver in a directory included in your PATH.
|
||||
|
||||
echo Installation partially complete for Windows. Follow manual steps above.
|
||||
echo If pyAudio fails to install, please install portaudio manually and try again.
|
||||
echo Also, chromedriver-autoinstaller should handle chromedriver automatically.
|
||||
echo If needed, download chromedriver manually from: https://sites.google.com/chromium.org/driver/getting-started
|
||||
pause
|
||||
Reference in New Issue
Block a user