pathScripts/pippin
2024-08-03 00:22:15 -07:00

34 lines
941 B
Bash
Executable file

#!/bin/bash
# Check if an argument is provided
if [ $# -eq 0 ]; then
echo "Usage: $0 <conda_environment_name>"
exit 1
fi
# Get the conda environment name from the command line argument
env_name="$1"
# Check if the conda environment already exists
if ! conda info --envs | grep -q "^$env_name "; then
echo "Creating new conda environment: $env_name"
conda create -n "$env_name" python=3.9 -y
else
echo "Conda environment '$env_name' already exists"
fi
# Activate the conda environment
eval "$(conda shell.bash hook)"
conda activate "$env_name"
# Get the path to the conda environment's python binary
conda_python=$(which python)
# Recursively search for requirements.txt files and install dependencies
find . -name "requirements.txt" | while read -r req_file; do
echo "Installing requirements from: $req_file"
"$conda_python" -m pip install -r "$req_file"
done
echo "All requirements.txt files processed."