Spaces:
Build error
Build error
| set -eux # Keep this for detailed logging | |
| export CUDA_VISIBLE_DEVICES="0" | |
| export CUDA_HOME="/usr/local/cuda" | |
| echo "Attempting to locate and activate Conda environment..." | |
| # Add a common Conda binary path to PATH (keeping this just in case, but it's failing) | |
| export PATH="/opt/conda/bin:$PATH" | |
| # --- DIAGNOSTIC STEPS: List contents of common Conda installation directories --- | |
| echo "Listing contents of /opt/:" | |
| ls -la /opt/ || echo "ls /opt/ failed or directory not found." | |
| echo "Listing contents of /usr/local/:" | |
| ls -la /usr/local/ || echo "ls /usr/local/ failed or directory not found." | |
| echo "Listing contents of /root/ (if accessible):" | |
| ls -la /root/ || echo "ls /root/ failed or directory not found (may be permission denied)." | |
| echo "--- END DIAGNOSTIC ---" | |
| # 1. Try to find the 'conda' executable in the system's PATH | |
| CONDA_EXEC=$(which conda) | |
| if [ -z "$CONDA_EXEC" ]; then | |
| echo "ERROR: 'conda' executable still not found in PATH." | |
| echo "This strongly suggests Conda is either not installed in the base image 'elungky/gen3c:latest', or it's in a highly unusual and non-standard location." | |
| exit 1 # Exit here, no point in continuing if conda isn't found | |
| fi | |
| # The following lines will only execute if CONDA_EXEC is not empty | |
| echo "Found 'conda' executable at: $CONDA_EXEC" | |
| # 2. Derive the base Conda installation path from the executable's location. | |
| CONDA_BASE_PATH=$(dirname $(dirname "$CONDA_EXEC")) | |
| echo "Derived Conda base path: $CONDA_BASE_PATH" | |
| # 3. Construct the path to conda.sh script based on the derived base path | |
| CONDA_SH_PATH="$CONDA_BASE_PATH/etc/profile.d/conda.sh" | |
| if [ -f "$CONDA_SH_PATH" ]; then | |
| echo "Found conda.sh at: $CONDA_SH_PATH" | |
| source "$CONDA_SH_PATH" || { echo "ERROR: Failed to source conda.sh script at $CONDA_SH_PATH. Check permissions."; exit 1; } | |
| else | |
| echo "ERROR: conda.sh not found at expected location derived from 'conda' executable: $CONDA_SH_PATH" | |
| exit 1 | |
| fi | |
| echo "Conda environment initialized successfully." | |
| # Activate the specific conda environment | |
| conda activate cosmos-predict1 || { echo "ERROR: Failed to activate conda environment 'cosmos-predict1'. Ensure it exists and is accessible for this user."; exit 1; } | |
| # Set PYTHONPATH after conda activation, as conda might adjust PATH/PYTHONPATH internally. | |
| export PYTHONPATH="/app:/app/gui/api" | |
| echo "Starting GEN3C FastAPI inference server..." | |
| export GEN3C_CKPT_PATH="/app/checkpoints" | |
| export GEN3C_GPU_COUNT=1 | |
| exec uvicorn gui.api.server:app --host 0.0.0.0 --port 7860 --proxy-headers |