-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_environment.sh
More file actions
executable file
·61 lines (48 loc) · 1.73 KB
/
setup_environment.sh
File metadata and controls
executable file
·61 lines (48 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# BirdNET-CoreML Environment Setup Script
# This script creates a clean Python virtual environment and installs all dependencies
set -e # Exit on any error
VENV_NAME="birdnet_clean_venv"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "🐦 Setting up BirdNET-CoreML environment..."
# Check if Python 3.11+ is available
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is required but not installed."
exit 1
fi
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
echo "📍 Using Python $PYTHON_VERSION"
# Create virtual environment
echo "🔧 Creating virtual environment: $VENV_NAME"
cd "$SCRIPT_DIR"
rm -rf "$VENV_NAME"
python3 -m venv "$VENV_NAME"
# Activate virtual environment
echo "🔌 Activating virtual environment..."
source "$VENV_NAME/bin/activate"
# Upgrade pip
echo "⬆️ Upgrading pip..."
pip install --upgrade pip
# Install core dependencies
echo "📦 Installing TensorFlow for macOS..."
pip install tensorflow-macos==2.15.0
echo "📦 Installing CoreML Tools..."
pip install coremltools==8.3.0
# Install additional dependencies if requirements.txt exists
if [ -f "requirements.txt" ]; then
echo "📦 Installing additional dependencies from requirements.txt..."
pip install -r requirements.txt
else
echo "📦 Installing common dependencies..."
pip install numpy librosa scikit-learn
fi
echo "✅ Environment setup complete!"
echo ""
echo "To activate the environment in the future, run:"
echo " cd $SCRIPT_DIR"
echo " source $VENV_NAME/bin/activate"
echo ""
echo "To test the export script, run:"
echo " python coreml_export/export_coreml_gpt03.py --help"
echo ""
echo "🎉 You're ready to convert BirdNET models to CoreML!"