I have tried installing crewai in alpine image with attached dockerfile. Here’s the issue of dependency mismatched for chromadb and onnxruntime.
Dockerfile:
FROM python:3.12.8-alpine AS builder # Set environment variables to ensure that Python behaves in a non-interactive mode ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 # Install system dependencies for pyodbc RUN apk add --no-cache \ unixodbc \ unixodbc-dev \ g++ \ build-base \ curl \ gnupg \ linux-headers # Set the working directory inside the container WORKDIR /apps/licensechat # Copy only requirements first to leverage Docker caching COPY ./licensechat/requirements.txt /apps/licensechat/requirements.txt # Install dependencies from the requirements.txt file RUN pip install --upgrade pip && \ pip install --no-cache-dir --prefix=/install -r requirements.txt FROM python:3.12.8-alpine ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 # Install libstdc++ which is required by ml_dtypes RUN apk add --no-cache libstdc++ # Set the working directory inside the container WORKDIR /apps/licensechat # Copy installed dependencies from builder stage COPY --from=builder /install /usr/local RUN apk add --no-cache \ curl # Install Microsoft ODBC Driver for SQL Server RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.10.4.1-1_amd64.apk && \ curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.10.1.1-1_amd64.apk && \ apk add --allow-untrusted msodbcsql17_17.10.4.1-1_amd64.apk && \ apk add --allow-untrusted mssql-tools_17.10.1.1-1_amd64.apk && \ rm msodbcsql17_17.10.4.1-1_amd64.apk && \ rm mssql-tools_17.10.1.1-1_amd64.apk # Copy the entire application into the container's working directory COPY ./licensechat /apps/licensechat/ # Expose FastAPI Port EXPOSE 8002 # Default command to run the application ENTRYPOINT ["python", "app.py"]
Issue:
11.89 Collecting chroma-hnswlib==0.7.6 (from chromadb>=0.5.23->crewai==0.105.0->-r requirements.txt (line 18))
11.91 Downloading chroma_hnswlib-0.7.6.tar.gz (32 kB)
11.91 Installing build dependencies: started
16.57 Installing build dependencies: finished with status 'done'
16.57 Getting requirements to build wheel: started
17.12 Getting requirements to build wheel: finished with status 'done'
17.12 Preparing metadata (pyproject.toml): started
17.68 Preparing metadata (pyproject.toml): finished with status 'done'
17.72 Collecting posthog>=2.4.0 (from chromadb>=0.5.23->crewai==0.105.0->-r requirements.txt (line 18))
17.73 Downloading posthog-3.19.0-py2.py3-none-any.whl.metadata (2.9 kB)
17.78 INFO: pip is looking at multiple versions of chromadb to determine which version is compatible with other requirements. This could take a while.
17.78 Collecting chromadb>=0.5.23 (from crewai==0.105.0->-r requirements.txt (line 18))
17.80 Downloading chromadb-0.6.2-py3-none-any.whl.metadata (6.8 kB)
17.81 Downloading chromadb-0.6.1-py3-none-any.whl.metadata (6.8 kB)
17.83 Downloading chromadb-0.6.0-py3-none-any.whl.metadata (6.8 kB)
17.85 Downloading chromadb-0.5.23-py3-none-any.whl.metadata (6.8 kB)
17.86 ERROR: Cannot install crewai because these package versions have conflicting dependencies.
17.86
17.86 The conflict is caused by:
17.86 chromadb 0.6.3 depends on onnxruntime>=1.14.1
17.86 chromadb 0.6.2 depends on onnxruntime>=1.14.1
17.86 chromadb 0.6.1 depends on onnxruntime>=1.14.1
17.86 chromadb 0.6.0 depends on onnxruntime>=1.14.1
17.86 chromadb 0.5.23 depends on onnxruntime>=1.14.1
17.86
17.86 To fix this you could try to:
17.86 1. loosen the range of package versions you've specified
17.86 2. remove package versions to allow pip to attempt to solve the dependency conflict
17.86
17.95 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
------
failed to solve: process "/bin/sh -c pip install --upgrade pip && pip install --no-cache-dir --prefix=/install -r requirements.txt" did not complete successfully: exit code: 1