Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ghcr.io/chroma-core/chroma does not support arm64 architecture #972

Closed
jpmcb opened this issue Aug 12, 2023 · 6 comments
Closed

[Bug]: ghcr.io/chroma-core/chroma does not support arm64 architecture #972

jpmcb opened this issue Aug 12, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@jpmcb
Copy link

jpmcb commented Aug 12, 2023

What happened?

On a M-chip Macbook, attempting to use chroma via the GitHub contaienr registry gives:

❯ docker run ghcr.io/chroma-core/chroma:0.4.5

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

It then attempts to rebuild some bits for the different architecture which looks like it's intentionally rebuilds some dependencies to support cross architecture.

Is it possible to support docker buildx in the container build?

docker build . --target chroma_server -t ghcr.io/chroma-core/chroma-server:`bin/version`


May also be related to #642 with some discussion of supporting arm images builds.

Versions

Chroma image 0.4.5

❯ uname -a
Darwin johns-mbp.lan 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:58 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6020 arm64

Relevant log output

No response

@jpmcb jpmcb added the bug Something isn't working label Aug 12, 2023
@jpmcb
Copy link
Author

jpmcb commented Aug 12, 2023

I was able to get this to work abit better with the following diff:

diff --git a/Dockerfile b/Dockerfile
index 489a6a96..f95c98f5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,6 @@
-FROM python:3.10-slim-bookworm as builder
+FROM --platform=$BUILDPLATFORM python:3.10-slim-bookworm as builder
+
+ARG BUILDPLATFORM

 RUN apt-get update --fix-missing && apt-get install -y --fix-missing \
     build-essential \
@@ -13,7 +15,9 @@ COPY ./requirements.txt requirements.txt

 RUN pip install --no-cache-dir --upgrade --prefix="/install" -r requirements.txt

-FROM python:3.10-slim-bookworm as final
+FROM --platform=$TARGETPLATFORM python:3.10-slim-bookworm as final
+
+ARG TARGETPLATFORM

 RUN apt-get update --fix-missing && apt-get install -y --fix-missing \
     build-essential \
diff --git a/bin/build b/bin/build
index 5e324198..ae908c4f 100755
--- a/bin/build
+++ b/bin/build
@@ -1,3 +1,3 @@
 #!/usr/bin/env bash

-docker build . --target chroma_server -t ghcr.io/chroma-core/chroma-server:`bin/version`
+docker buildx build --load . --target chroma_server -t ghcr.io/jpmcb/chroma-server:`bin/version`
diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh
index 3b0d146c..afb672d7 100755
--- a/bin/docker_entrypoint.sh
+++ b/bin/docker_entrypoint.sh
@@ -1,6 +1,4 @@
 #!/bin/bash

-echo "Rebuilding hnsw to ensure architecture compatibility"
-pip install --force-reinstall --no-cache-dir chroma-hnswlib
 export IS_PERSISTENT=1
 uvicorn chromadb.app:app --workers 1 --host 0.0.0.0 --port 8000 --proxy-headers --log-config log_config.yml

Happy to open a PR.

Essentially this:

  • Uses docker buildx to do cross image building. This also utilizes the BUILDPLATFORM and TARGETPLATFORM arguments for those builds in order to ensure the final cross image uses the target platform's architecture.
  • Removes the re-building since that seems unnecessary for the cross architecture image

This was build with:

❯ docker buildx build \
            --tag=chroma-test:latest \
            --load \
            .

And I'm able to run it locally with:

❯ docker run -it --rm chroma-test
2023-08-12 15:26:44 INFO     chromadb.telemetry.posthog Anonymized telemetry enabled. See https://docs.trychroma.com/telemetry for more information.
2023-08-12 15:26:44 DEBUG    chromadb.config Starting component System
2023-08-12 15:26:44 DEBUG    chromadb.config Starting component Posthog
2023-08-12 15:26:44 DEBUG    chromadb.config Starting component SqliteDB
2023-08-12 15:26:44 DEBUG    chromadb.config Starting component LocalSegmentManager
2023-08-12 15:26:44 DEBUG    chromadb.config Starting component SegmentAPI
2023-08-12 15:26:44 INFO     uvicorn.error   Started server process [7]
2023-08-12 15:26:44 INFO     uvicorn.error   Waiting for application startup.
2023-08-12 15:26:44 INFO     uvicorn.error   Application startup complete.
2023-08-12 15:26:44 INFO     uvicorn.error   Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

@HammadB
Copy link
Collaborator

HammadB commented Aug 12, 2023

I think #857 is addressing this

@jpmcb
Copy link
Author

jpmcb commented Aug 12, 2023

Nice! I'll give that change a try: thanks for pointing me to that!

Closed by #857

@HammadB
Copy link
Collaborator

HammadB commented Aug 14, 2023

@jpmcb Did that fix your issue?

@jeffchuber
Copy link
Contributor

@jpmcb did this fix your issue?

@HammadB
Copy link
Collaborator

HammadB commented Dec 4, 2023

Closing as stale, I think #857 should address this

@HammadB HammadB closed this as completed Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants