Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-12 08:24:58

0001 #!/bin/bash
0002 # AID2E Framework - Install Dependencies Locally
0003 # This script installs Python dependencies from pyproject.toml into the
0004 # current working directory using pip install with --target.
0005 #
0006 # Designed for remote PanDA/iDDS workers where a full virtualenv may not
0007 # be available. Dependencies are installed locally so they can be found
0008 # via PYTHONPATH set by setup_aid2e.sh.
0009 #
0010 # Project: AID2E v0.0.0 - AI assisted Detector Design for EIC
0011 
0012 # Do not use set -e; we want to continue past non-critical failures
0013 
0014 # Get the directory where this script is located
0015 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
0016 
0017 # Local install target: <script_dir>/.local/lib
0018 LOCAL_LIB="$SCRIPT_DIR/.local/lib"
0019 mkdir -p "$LOCAL_LIB"
0020 
0021 echo "============================================="
0022 echo " AID2E - Installing Dependencies Locally"
0023 echo "============================================="
0024 echo "Script directory : $SCRIPT_DIR"
0025 echo "Install target   : $LOCAL_LIB"
0026 echo ""
0027 
0028 # Check if pyproject.toml exists
0029 if [ ! -f "$SCRIPT_DIR/pyproject.toml" ]; then
0030     echo "Error: pyproject.toml not found in $SCRIPT_DIR"
0031     exit 1
0032 fi
0033 
0034 # Install the project and its dependencies locally
0035 echo "Installing aid2e and core dependencies..."
0036 pip install --target "$LOCAL_LIB" "$SCRIPT_DIR" --no-deps  2>/dev/null || \
0037     echo "Warning: pip install of aid2e package failed, continuing..."
0038 
0039 echo ""
0040 echo "Installing core dependencies..."
0041 pip install --target "$LOCAL_LIB" \
0042     "pyyaml>=5.4" \
0043     "pydantic>=2.0" \
0044     "click>=8.0" \
0045     "numpy" \
0046     || echo "Warning: Some core dependencies could not be installed."
0047 
0048 # Install joblib for local parallel execution
0049 echo ""
0050 echo "Installing joblib..."
0051 pip install --target "$LOCAL_LIB" "joblib>=1.0"  2>/dev/null || true
0052 
0053 # Add local lib to PYTHONPATH if not already there
0054 if [[ ":$PYTHONPATH:" != *":$LOCAL_LIB:"* ]]; then
0055     if [ -z "$PYTHONPATH" ]; then
0056         export PYTHONPATH="$LOCAL_LIB"
0057     else
0058         export PYTHONPATH="$LOCAL_LIB:$PYTHONPATH"
0059     fi
0060 fi
0061 
0062 echo ""
0063 echo "============================================="
0064 echo " AID2E Dependencies Installed Successfully"
0065 echo "============================================="
0066 echo "PYTHONPATH: $PYTHONPATH"
0067 echo ""
0068 echo "Dependencies installed to: $LOCAL_LIB"