chroma-core / chroma

the AI-native open-source embedding database
https://www.trychroma.com/
Apache License 2.0
14.41k stars 1.2k forks source link

[Install issue]: #1590

Closed reasonmethis closed 8 months ago

reasonmethis commented 8 months ago

What happened?

I ran:

docker run --env-file ./.chroma_env -p 8000:8000 -v ./my-chroma/:/chroma/chroma chromadb/chroma

with the contents of .chroma_env being

CHROMA_SERVER_AUTH_CREDENTIALS="somestring"
CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER="chromadb.auth.token.TokenConfigServerAuthCredentialsProvider"
CHROMA_SERVER_AUTH_PROVIDER="chromadb.auth.token.TokenAuthServerProvider"
CHROMA_SERVER_AUTH_TOKEN_TRANSPORT_HEADER="X_CHROMA_TOKEN"

and got an error:

ModuleNotFoundError: No module named '"chromadb'

I double-checked that I have the most recent version of the Docker image and that the environment variables are defined as described in the Authentication section of the docs.

Interestingly, running

docker run -p 8000:8000 -v ./my-chroma/:/chroma/chroma chromadb/chroma

doesn't run into a problem (except for the "is" bug, which is still reported in the logs).

Versions

Docker 24.0.7

Relevant log output

Rebuilding hnsw to ensure architecture compatibility
Collecting chroma-hnswlib
  Downloading chroma_hnswlib-0.7.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 28.3 MB/s eta 0:00:00
Collecting numpy
  Downloading numpy-1.26.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.2/18.2 MB 24.0 MB/s eta 0:00:00
Installing collected packages: numpy, chroma-hnswlib
  Attempting uninstall: numpy
    Found existing installation: numpy 1.26.2
    Uninstalling numpy-1.26.2:
      Successfully uninstalled numpy-1.26.2
  Attempting uninstall: chroma-hnswlib
    Found existing installation: chroma-hnswlib 0.7.3
    Uninstalling chroma-hnswlib-0.7.3:
      Successfully uninstalled chroma-hnswlib-0.7.3
Successfully installed chroma-hnswlib-0.7.3 numpy-1.26.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 23.0.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
/chroma/./chromadb/utils/embedding_functions.py:613: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self._task_type is "RETRIEVAL_DOCUMENT":
DEBUG:    [26-12-2023 22:00:41] Registering provider: token_config
DEBUG:    [26-12-2023 22:00:41] Registering provider: user_token_config
DEBUG:    [26-12-2023 22:00:41] Registering provider: token
DEBUG:    [26-12-2023 22:00:41] Registering provider: token
WARNING:  [26-12-2023 22:00:41] chroma_server_nofile is set to 65535, but this is less than current soft limit of 1048576. chroma_server_nofile will not be set.
INFO:     [26-12-2023 22:00:41] Anonymized telemetry enabled. See                     https://docs.trychroma.com/telemetry for more information.
DEBUG:    [26-12-2023 22:00:41] Starting component System
DEBUG:    [26-12-2023 22:00:41] Starting component OpenTelemetryClient
DEBUG:    [26-12-2023 22:00:41] Starting component SimpleAssignmentPolicy
DEBUG:    [26-12-2023 22:00:41] Starting component SqliteDB
DEBUG:    [26-12-2023 22:00:42] Starting component Posthog
DEBUG:    [26-12-2023 22:00:42] Starting component LocalSegmentManager
DEBUG:    [26-12-2023 22:00:42] Starting component SegmentAPI
DEBUG:    [26-12-2023 22:00:42] Server Auth Provider: "chromadb.auth.token.TokenAuthServerProvider"
DEBUG:    [26-12-2023 22:00:42] Registering provider: local_authz_config
DEBUG:    [26-12-2023 22:00:42] Registering provider: simple_rbac
DEBUG:    [26-12-2023 22:00:42] Registering provider: basic
DEBUG:    [26-12-2023 22:00:42] Registering provider: basic
DEBUG:    [26-12-2023 22:00:42] Registering provider: htpasswd_file
Traceback (most recent call last):
  File "/usr/local/bin/uvicorn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 408, in main
    run(
  File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 576, in run
    server.run()
  File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 67, in serve
    config.load()
  File "/usr/local/lib/python3.10/site-packages/uvicorn/config.py", line 479, in load
    self.loaded_app = import_from_string(self.app)
  File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 24, in import_from_string
    raise exc from None
  File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, 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 159, in __init__
    auth_middleware=self._api.require(FastAPIChromaAuthMiddleware),
  File "/chroma/./chromadb/config.py", line 274, in require
    inst = self._system.instance(type)
  File "/chroma/./chromadb/config.py", line 366, in instance
    impl = type(self)
  File "/chroma/./chromadb/auth/fastapi.py", line 85, in __init__
    _cls = resolve_provider(
  File "/chroma/./chromadb/auth/registry.py", line 123, in resolve_provider
    return get_class(class_or_name, cls)  # type: ignore
  File "/chroma/./chromadb/utils/__init__.py", line 10, in get_class
    module = importlib.import_module(module_name)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named '"chromadb'
tazarov commented 8 months ago

Hey @reasonmethis, the issue you are facing concerns .chroma_env and how docker handles them. It appears that double quotes " are being handled as a regular character, and thus the error you see '"chromadb'. Please remove the sections, and you should be fine. In the meantime, I will fix this in our template and docs so it doesn't cause any further headaches.

reasonmethis commented 8 months ago

Ah, interesting, thanks!

jeffchuber commented 8 months ago

thanks @tazarov !