wu981526092 commited on
Commit
87ee823
·
1 Parent(s): d6c7c85

Fix: Explicitly install langchain in Dockerfile to bypass cache

Browse files

🐛 Problem:
- HF Spaces still showing: No module named 'langchain_community'
- pyproject.toml was updated but Docker build might be using cache
- Dependencies not being properly installed despite pyproject.toml update

✅ Solution:
Dockerfile changes:
- Explicitly install langchain>=0.3.0 before installing project
- Explicitly install langchain-community>=0.3.0 before installing project
- Added timestamp comment to force Docker layer rebuild
- Ensures langchain packages installed even if cache is stale

🔧 Install Order:
1. pip install --upgrade pip
2. pip install langchain langchain-community (explicit)
3. pip install -e . (project + other dependencies)

This guarantees langchain is available even if Docker cache prevents
pyproject.toml changes from being recognized.

🎯 Expected Result:
- Fresh Docker build with langchain packages
- Backend starts successfully
- No more import errors

Files changed (1) hide show
  1. Dockerfile +4 -0
Dockerfile CHANGED
@@ -34,7 +34,11 @@ WORKDIR /app
34
  COPY --chown=user pyproject.toml ./
35
 
36
  # Install dependencies directly with pip (more reliable than uv)
 
37
  RUN pip install --user --upgrade pip && \
 
 
 
38
  pip install --user --timeout=600 --retries=3 --no-cache-dir -e .
39
 
40
  # Copy application code with proper ownership
 
34
  COPY --chown=user pyproject.toml ./
35
 
36
  # Install dependencies directly with pip (more reliable than uv)
37
+ # Force fresh install with langchain packages (2025-10-15)
38
  RUN pip install --user --upgrade pip && \
39
+ pip install --user --timeout=600 --retries=3 --no-cache-dir \
40
+ "langchain>=0.3.0" \
41
+ "langchain-community>=0.3.0" && \
42
  pip install --user --timeout=600 --retries=3 --no-cache-dir -e .
43
 
44
  # Copy application code with proper ownership