1.正常启动chromadb
2.执行如下代码
import chromadb
chroma_client = chromadb.HttpClient(host='localhost', port=8000)
3.错误信息:
---------------------------------------------------------------------------HTTPStatusError Traceback (most recent call last)
File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/api/base_http_client.py:100, in BaseHTTPClient._raise_chroma_error(resp) 99 try:--> 100 resp.raise_for_status() 101 except httpx.HTTPStatusError:
File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/httpx/_models.py:829, in Response.raise_for_status(self) 828 message = message.format(self, error_type=error_type)--> 829 raise HTTPStatusError(message, request=request, response=self)HTTPStatusError: Server error '502 Bad Gateway' for url 'http://localhost:8000/api/v2/auth/identity'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502During handling of the above exception, another exception occurred:Exception Traceback (most recent call last)
File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/api/client.py:108, in Client.get_user_identity(self) 107 try:--> 108 return self._server.get_user_identity() 109 except httpx.ConnectError:
File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/telemetry/opentelemetry/__init__.py:150, in trace_method.<locals>.decorator.<locals>.wrapper(*args, **kwargs) 149 if trace_granularity < granularity:--> 150 return f(*args, **kwargs) 151 if not tracer:
File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/api/fastapi.py:202, in FastAPI.get_user_identity(self) 199 @trace_method("FastAPI.get_user_identity", OpenTelemetryGranularity.OPERATION) 200 @override 201 def get_user_identity(self) -> UserIdentity:--> 202 return UserIdentity(**self._make_request("get", "/auth/identity"))
File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/api/fastapi.py:108, in FastAPI._make_request(self, method, path, **kwargs) 107 response = self._session.request(method, url, **cast(Any, kwargs))--> 108 BaseHTTPClient._raise_chroma_error(response) 109 return orjson.loads(response.text)
File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/api/base_http_client.py:105, in BaseHTTPClient._raise_chroma_error(resp) 104 raise Exception(f"{resp.text} (trace ID: {trace_id})")--> 105 raise (Exception(resp.text))Exception:
During handling of the above exception, another exception occurred:ValueError Traceback (most recent call last)
Cell In[28], line 3 1 import chromadb----> 3 chroma_client = chromadb.HttpClient(host='localhost', port=8000)File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/__init__.py:242, in HttpClient(host, port, ssl, headers, settings, tenant, database) 239 settings.chroma_server_ssl_enabled = ssl 240 settings.chroma_server_headers = headers--> 242 return ClientCreator(tenant=tenant, database=database, settings=settings)File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/api/client.py:72, in Client.__init__(self, tenant, database, settings) 69 # Get the root system component we want to interact with 70 self._server = self._system.instance(ServerAPI)---> 72 user_identity = self.get_user_identity() 74 maybe_tenant, maybe_database = maybe_set_tenant_and_database( 75 user_identity, 76 overwrite_singleton_tenant_database_access_from_auth=settings.chroma_overwrite_singleton_tenant_database_access_from_auth, 77 user_provided_tenant=tenant, 78 user_provided_database=database, 79 ) 80 if maybe_tenant:
File /opt/miniconda3/envs/chapter1/lib/python3.10/site-packages/chromadb/api/client.py:117, in Client.get_user_identity(self) 115 raise e 116 except Exception as e:--> 117 raise ValueError(str(e))ValueError: