CoolFace
Apppublic

RCaz/Build_small_hackathon_Thousand_tokens_world

sourceHugging Facemitupdated 2mo agoView on Hugging Face
0likes
setup_env.sh79 linesDownload Raw Back to root
1#!/usr/bin/env bash2set -euo pipefail3 4ENV_NAME="${1:-crewai_test}"5ENV_DIR="/Applications/anaconda3/envs/$ENV_NAME"6ENV_PYTHON="$ENV_DIR/bin/python"7ENV_PIP="$ENV_PYTHON -m pip"8 9echo ">>> Creating conda env: $ENV_NAME"10conda create -n "$ENV_NAME" python=3.12 -y11 12# ------------------------------------------------------------------13# DEPENDENCY RESOLUTION STRATEGY14#15# pip's resolver refuses to install packages with conflicting16# declared metadata, even when they work fine at runtime. The known17# conflicts are:18#19#   crewai 1.9.3  → openai~=1.83, aiosqlite~=0.21, opentelemetry-sdk~=1.34, pydantic~=2.11, tokenizers~=0.2020#   litellm 1.88.1 → openai>=2.20, tokenizers>=0.2121#   arize-phoenix 17.2.0 → aiosqlite>=0.22, opentelemetry-sdk (any), pydantic-ai-slim (any)22#23# At runtime all version pairs are compatible. The workaround is to24# install in layers with --no-deps for the conflicting packages.25#26# Step 1 — Install base deps (pip resolves these cleanly).27# Step 2 — Override openai + litellm (--no-deps bypasses the ~=1.83/>=2.20 clash).28# Step 3 — Override OTel to 1.42.x (phoenix needs semconv attrs missing from 0.55).29# Step 4 — Install phoenix's heavy transitive deps (scikit-learn, pydantic-ai-slim, …).30# Step 5 — Install arize-phoenix itself (--no-deps bypasses aiosqlite/OTel clash).31# ------------------------------------------------------------------32 33echo ">>> Step 1 — base packages"34$ENV_PIP install \35  crewai==1.9.3 crewai-tools==1.9.3 \36  python-dotenv==1.1.1 httpx==0.28.1 modal==1.5.0 gradio==6.17.3 \37  openinference-instrumentation-crewai==1.1.9 \38  openinference-instrumentation-openai==0.1.51 \39  --only-binary :all:40 41echo ">>> Step 2 — upgrade openai + install litellm (--no-deps)"42$ENV_PIP install "openai>=2.20.0,<3.0.0" litellm==1.88.1 fastuuid --no-deps --force-reinstall43 44echo ">>> Step 3 — upgrade OTel packages for phoenix compat (--no-deps)"45$ENV_PIP install \46  "opentelemetry-sdk>=1.42.0" \47  "opentelemetry-semantic-conventions>=0.60b0" \48  "opentelemetry-api>=1.42.0" \49  "opentelemetry-exporter-otlp>=1.42.0" \50  "opentelemetry-proto>=1.42.0" \51  --no-deps --force-reinstall52 53echo ">>> Step 4 — phoenix transitive deps"54$ENV_PIP install \55  aioitertools alembic email-validator authlib joserfc jsonpath-ng ldap3 \56  grpc-interceptor prometheus-client psutil pystache sqlean-py strawberry-graphql \57  jmespath "aiosqlite>=0.22.1" \58  "pydantic-ai-slim>=1.95.0" anthropic "google-genai>=1.0.0" \59  "mcp>=1.27.0" "tokenizers>=0.21.0" \60  --only-binary :all:61 62echo ">>> Step 5 — scikit-learn metadata (phoenix reads its version at import)"63$ENV_PIP install scikit-learn --force-reinstall --only-binary :all:64 65echo ">>> Step 6 — arize-phoenix itself (--no-deps)"66$ENV_PIP install arize-phoenix==17.2.0 arize-phoenix-client arize-phoenix-evals arize-phoenix-otel --no-deps67 68echo ">>> Verifying import..."69$ENV_PYTHON -c "70from phoenix.otel import register71from openinference.instrumentation.openai import OpenAIInstrumentor72from crew2 import run_pipeline, generate_image, generate_voice, transcribe_audio73print('All imports OK')74" 2>&1 | grep -E '^All|Traceback|Error'75 76echo ""77echo "=== Setup complete: $ENV_NAME ==="78echo "Run: conda activate $ENV_NAME && python app.py"79