chroma: [Bug]: `chromadb` is missing in 0.4.8 released image

What happened?

When trying to set-up the recently added token authentication with chroma release 0.4.8 we need to make imports from the python chromadb package to set up authentication namely:

  • chromadb.auth.token.TokenConfigServerAuthCredentialsProvider
  • chromadb.auth.token.TokenAuthServerProvider However I suspect the docker image is built without installing chromadb resulting in the module not found error. If provided some guidance I’d be happy to write the fix.

Versions

Using ghcr.io/chroma-core/chroma:0.4.8

Relevant log output

chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.config Starting component System
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.config Starting component Posthog
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.config Starting component SqliteDB
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.config Starting component LocalSegmentManager
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.config Starting component SegmentAPI
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.auth.fastapi Server Auth Provider: 'chromadb.auth.token.TokenAuthServerProvider'
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.auth.registry Registering provider: basic
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.auth.registry Registering provider: basic
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.auth.registry Registering provider: htpasswd_file
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.auth.registry Registering provider: token_config
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.auth.registry Registering provider: token
chroma-test_server-1  | 2023-08-31 13:15:27 DEBUG    chromadb.auth.registry Registering provider: token
chroma-test_server-1  | Traceback (most recent call last):
chroma-test_server-1  |   File "/usr/local/bin/uvicorn", line 8, in <module>
chroma-test_server-1  |     sys.exit(main())
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
chroma-test_server-1  |     return self.main(*args, **kwargs)
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
chroma-test_server-1  |     rv = self.invoke(ctx)
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
chroma-test_server-1  |     return ctx.invoke(self.callback, **ctx.params)
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
chroma-test_server-1  |     return __callback(*args, **kwargs)
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 408, in main
chroma-test_server-1  |     run(
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 576, in run
chroma-test_server-1  |     server.run()
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run
chroma-test_server-1  |     return asyncio.run(self.serve(sockets=sockets))
chroma-test_server-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
chroma-test_server-1  |     return loop.run_until_complete(main)
chroma-test_server-1  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 67, in serve
chroma-test_server-1  |     config.load()
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/config.py", line 479, in load
chroma-test_server-1  |     self.loaded_app = import_from_string(self.app)
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 24, in import_from_string
chroma-test_server-1  |     raise exc from None
chroma-test_server-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 21, in import_from_string
chroma-test_server-1  |     module = importlib.import_module(module_str)
chroma-test_server-1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
chroma-test_server-1  |     return _bootstrap._gcd_import(name[level:], package, level)
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
chroma-test_server-1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
chroma-test_server-1  |   File "/chroma/./chromadb/app.py", line 6, in <module>
chroma-test_server-1  |     server = FastAPI(settings)
chroma-test_server-1  |   File "/chroma/./chromadb/server/fastapi/__init__.py", line 117, in __init__
chroma-test_server-1  |     self._auth_middleware = self._api.require(FastAPIChromaAuthMiddleware)
chroma-test_server-1  |   File "/chroma/./chromadb/config.py", line 188, in require
chroma-test_server-1  |     inst = self._system.instance(type)
chroma-test_server-1  |   File "/chroma/./chromadb/config.py", line 247, in instance
chroma-test_server-1  |     impl = type(self)
chroma-test_server-1  |   File "/chroma/./chromadb/auth/fastapi.py", line 70, in __init__
chroma-test_server-1  |     _cls = resolve_provider(
chroma-test_server-1  |   File "/chroma/./chromadb/auth/registry.py", line 107, in resolve_provider
chroma-test_server-1  |     return get_class(class_or_name, cls)  # type: ignore
chroma-test_server-1  |   File "/chroma/./chromadb/utils/__init__.py", line 10, in get_class
chroma-test_server-1  |     module = importlib.import_module(module_name)
chroma-test_server-1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
chroma-test_server-1  |     return _bootstrap._gcd_import(name[level:], package, level)
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
chroma-test_server-1  |   File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
chroma-test_server-1  | ModuleNotFoundError: No module named "'chromadb"
chroma-test_server-1 exited with code 1

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 15 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@tazarov it worked, thanks!

@brock-cares in docker-compose we work with env vars like so:

    command: uvicorn chromadb.app:app --reload --workers 1 --host 0.0.0.0 --port 8000 --log-config chromadb/log_config.yml
    environment:
      - IS_PERSISTENT=TRUE
      - CHROMA_SERVER_AUTH_PROVIDER=${CHROMA_SERVER_AUTH_PROVIDER}
      - CHROMA_SERVER_AUTH_CREDENTIALS_FILE=${CHROMA_SERVER_AUTH_CREDENTIALS_FILE}
      - CHROMA_SERVER_AUTH_CREDENTIALS=${CHROMA_SERVER_AUTH_CREDENTIALS}
      - CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER=${CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER}

And then, we pass along .env file. See here - https://docs.trychroma.com/usage-guide#running-the-server

@McDonnellJoseph, thank you! I already fixed it. Running integration tests, and I’ll push it.