[Bug]: Docker files not functioning properly
What happened?
Hi Folks,
here are the full list of commands and the error that is caused
git clone --depth 1 https://github.com/chroma-core/chroma
cd chroma
docker compose -f examples/observability/docker-compose.local-observability.yml up --build -d
docker logs -f observability-server-1
The error
WARNING: Please remove 'uvicorn chromadb.app:app' from your command line arguments. This is now handled by the entrypoint script.
INFO: [08-04-2025 21:44:07] Will watch for changes in these directories: ['/chroma']
INFO: [08-04-2025 21:44:07] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: [08-04-2025 21:44:07] Started reloader process [1] using WatchFiles
WARNING: [08-04-2025 21:44:08] chroma_server_nofile is set to 65536, but this is less than current soft limit of 1048576. chroma_server_nofile will not be set.
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
target(sockets=sockets)
File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 70, in serve
await self._serve(sockets)
File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 77, in _serve
config.load()
File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 435, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
raise exc from None
File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/chroma/chromadb/app.py", line 6, in <module>
server = FastAPI(settings)
^^^^^^^^^^^^^^^^^
File "/chroma/chromadb/server/fastapi/__init__.py", line 197, in __init__
self._api: ServerAPI = self._system.instance(ServerAPI)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/chroma/chromadb/config.py", line 447, in instance
type = get_class(fqn, type)
^^^^^^^^^^^^^^^^^^^^
File "/chroma/chromadb/config.py", line 496, in get_class
module = importlib.import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/chroma/chromadb/api/rust.py", line 36, in <module>
import chromadb_rust_bindings
ModuleNotFoundError: No module named 'chromadb_rust_bindings'
Versions
latest version as seen in the command
Relevant log output
@j0hnthebuilder, your observation is correct. In version 1.0.x we switched rust backend which requires bindings. The bindings need to be built before the new version can be used.
I'll provide shortly a dockerfile that will build the bindings and help you run from source.
@tazarov thank you very much friend 🥇 🙏
Hi @tazarov, hope you are well ❤ any chance you can share the commands with me so I can maybe try fix this and make a push request for it? thank youuuu
@j0hnthebuilder, here it goes:
FROM python:3.11-slim-bookworm AS builder
ARG REBUILD_HNSWLIB
ARG PROTOBUF_VERSION=28.2
RUN apt-get update --fix-missing && apt-get install -y --fix-missing \
build-essential \
gcc \
g++ \
cmake \
autoconf \
python3-dev \
unzip \
curl \
make && \
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable && \
rm -rf /var/lib/apt/lists/* && \
mkdir /install
ENV PATH="/root/.cargo/bin:$PATH"
# Install specific Protobuf compiler (v28.2)
RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip && \
unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -d /usr/local/ && \
rm protoc-${PROTOBUF_VERSION}-linux-x86_64.zip && \
chmod +x /usr/local/bin/protoc && \
protoc --version # Verify installed version
WORKDIR /install
COPY ./requirements.txt requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip pip install maturin cffi patchelf
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade --prefix="/install" -r requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip if [ "$REBUILD_HNSWLIB" = "true" ]; then pip install --no-binary :all: --force-reinstall --prefix="/install" chroma-hnswlib; fi
# Install gRPC tools for Python with fixed version
RUN pip install grpcio==1.58.0 grpcio-tools==1.58.0
# Copy source files to build Protobufs
COPY ./ /chroma
# Generate Protobufs
WORKDIR /chroma
RUN make -C idl proto_python
RUN python3 -m maturin build
RUN pip uninstall chromadb -y
RUN pip install --prefix="/install" --find-links target/wheels/ --upgrade chromadb
FROM python:3.11-slim-bookworm AS final
# Create working directory
RUN mkdir /chroma
WORKDIR /chroma
# Copy entrypoint
COPY ./bin/docker_entrypoint.sh /docker_entrypoint.sh
RUN apt-get update --fix-missing && apt-get install -y curl && \
chmod +x /docker_entrypoint.sh && \
rm -rf /var/lib/apt/lists/*
# Copy built dependencies and generated Protobufs
COPY --from=builder /install /usr/local
COPY --from=builder /chroma /chroma
ENV CHROMA_HOST_ADDR="0.0.0.0"
ENV CHROMA_HOST_PORT=8000
ENV CHROMA_WORKERS=1
ENV CHROMA_LOG_CONFIG="chromadb/log_config.yml"
ENV CHROMA_TIMEOUT_KEEP_ALIVE=30
EXPOSE 8000
ENTRYPOINT ["/docker_entrypoint.sh"]
CMD [ "--workers ${CHROMA_WORKERS} --host ${CHROMA_HOST_ADDR} --port ${CHROMA_HOST_PORT} --proxy-headers --log-config ${CHROMA_LOG_CONFIG} --timeout-keep-alive ${CHROMA_TIMEOUT_KEEP_ALIVE}"]
@j0hnthebuilder alternatively you can use pure rust CLI as follows:
FROM rust:1.81.0 AS builder
ARG RELEASE_MODE=release
ARG BRANCH=main
WORKDIR /chroma/
ENV PROTOC_ZIP=protoc-25.1-linux-x86_64.zip
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/$PROTOC_ZIP \
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
&& unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \
&& rm -f $PROTOC_ZIP
RUN git clone --branch trayan-04-08-fix_improving_backfil_error_propagation https://github.com/chroma-core/chroma.git .
# RUN git clone --branch ${BRANCH} https://github.com/chroma-core/chroma.git .
RUN apt-get update && \
apt-get install -y python3.11-dev
RUN cargo build --bin chroma --release
FROM debian:bookworm-slim
COPY --from=builder /chroma/target/release/chroma /usr/local/bin/
RUN apt-get update && \
apt-get install -y python3.11-dev
EXPOSE 8000
ENTRYPOINT ["chroma"]
CMD ["run","--path","/data","--host","0.0.0.0"]
@j0hnthebuilder should we keep this open or is everything squared away?
Hi @jeffchuber , I've requested a commit to fix the issue with a proper Dockerfile (courtesy of @tazarov) but nobody has approved it since, you can view it here
https://github.com/chroma-core/chroma/pull/4270
ok great! looks like @jairad26 is helping 🎉