From 1af5386b8863f93ea7491394c5699bb6ba971afd Mon Sep 17 00:00:00 2001 From: Nikolay Koldunov Date: Fri, 27 Mar 2026 11:45:30 +0100 Subject: [PATCH 1/2] fix: resolve langchain dependency conflicts and improve setup instructions - Remove langchain-classic from pip deps (requires langchain-core>=1.2.19, conflicts with conda langchain 0.3.x; only used as fallback import) - Pin langchain-anthropic<1.0.0 to stay compatible with langchain-core<1.0.0 - Move npm install before uvicorn start to prevent reload-triggered ETIMEDOUT - Add --reload-exclude for frontend/node_modules to uvicorn command --- README.md | 17 +++++++++++++---- environment.yml | 3 +-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9ec7e31..6f903de 100644 --- a/README.md +++ b/README.md @@ -73,19 +73,28 @@ OPENAI_API_KEY="sk-..." ARRAYLAKE_API_KEY="your-arraylake-key" ``` -### 4. Start the FastAPI backend +### 4. Install frontend dependencies ```bash -uvicorn api.main:app --host 0.0.0.0 --port 8000 --reload +cd frontend +npm install +cd .. +``` + +> **Important:** Run `npm install` *before* starting the backend. If uvicorn is already running with `--reload`, the creation of `node_modules/` triggers a server restart, causing temporary `ETIMEDOUT` proxy errors in the frontend. + +### 5. Start the FastAPI backend + +```bash +uvicorn api.main:app --host 0.0.0.0 --port 8000 --reload --reload-exclude 'frontend/node_modules/*' ``` The API runs on `http://localhost:8000`. Health check: `GET /health`. -### 5. Start the React frontend +### 6. Start the React frontend ```bash cd frontend -npm install npm run dev ``` diff --git a/environment.yml b/environment.yml index 63df334..1cb664a 100644 --- a/environment.yml +++ b/environment.yml @@ -69,7 +69,6 @@ dependencies: # pip-only packages (not available on conda-forge) - pip: - - langchain-classic - - langchain-anthropic + - langchain-anthropic<1.0.0 - arraylake - aitta-client From 473c526766d61c00c932b45a1dd7a97a7016fb66 Mon Sep 17 00:00:00 2001 From: Nikolay Koldunov Date: Fri, 27 Mar 2026 12:10:29 +0100 Subject: [PATCH 2/2] fix: catch TypeError from protobuf when importing streamlit in FastAPI context Streamlit's protobuf files can raise TypeError (not ImportError) when the installed protobuf version is incompatible. This crashes the FastAPI backend even though it doesn't use streamlit. Broadening the except clause to Exception prevents the crash. --- src/climsight/tools/destine_retrieval_tool.py | 2 +- src/climsight/tools/era5_retrieval_tool.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/climsight/tools/destine_retrieval_tool.py b/src/climsight/tools/destine_retrieval_tool.py index 8523538..5a7cf7d 100644 --- a/src/climsight/tools/destine_retrieval_tool.py +++ b/src/climsight/tools/destine_retrieval_tool.py @@ -29,7 +29,7 @@ try: import streamlit as st -except ImportError: +except Exception: st = None logger = logging.getLogger(__name__) diff --git a/src/climsight/tools/era5_retrieval_tool.py b/src/climsight/tools/era5_retrieval_tool.py index 5261804..0ad6d24 100644 --- a/src/climsight/tools/era5_retrieval_tool.py +++ b/src/climsight/tools/era5_retrieval_tool.py @@ -25,7 +25,7 @@ # Optional: Check for Streamlit to support session state if available try: import streamlit as st - except ImportError: + except Exception: st = None except ImportError as e: install_command = "pip install --upgrade xarray zarr arraylake pandas numpy pydantic langchain-core"