-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev_builder.sh
executable file
·42 lines (34 loc) · 1.23 KB
/
dev_builder.sh
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
#!/bin/bash
# Step 1: Ensure conda is available
if ! command -v conda &> /dev/null
then
echo "Conda could not be found. Please install Miniconda or Anaconda."
exit 1
fi
# Step 2: Extract environment name correctly (remove extra quotes)
env_name=$(grep "^name:" environment.yml | awk '{print $2}' | tr -d '"')
if [ -z "$env_name" ]; then
echo "Error: Could not determine the environment name from environment.yml."
exit 1
fi
echo "Checking if the environment '$env_name' exists..."
if conda info --envs | awk '{print $1}' | grep -qx "$env_name"; then
echo "Environment '$env_name' already exists. Skipping creation."
else
echo "Creating the Conda environment: $env_name"
conda env create -f environment.yml
fi
# Step 3: Ensure Conda is properly initialized
eval "$(conda shell.bash hook)"
# Step 4: Install dependencies using Poetry
echo "Installing dependencies with Poetry..."
if ! command -v poetry &> /dev/null
then
echo "Poetry is not installed. Installing Poetry..."
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
fi
poetry install
# Step 5: Confirm successful setup
echo "Setup complete! To activate your environment, run:"
echo " conda activate $env_name"