chroma-core / chroma-core/chroma
[Bug]: 'dict' object has no attribute 'persist_directory' al usar ChromaDB con PostgreSQL
- Dominant language
- Rust
- Stars
- 29.3k
- Forks
- 2.5k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 38
Description
### What happened?
# Bug report: Error 'dict' object has no attribute 'persist_directory' al usar ChromaDB con PostgreSQL
## Descripción
Al intentar usar ChromaDB (probado con 1.0.21 y 0.4.24) con backend PostgreSQL, obtengo el error:
```
Error al conectar o crear colección: 'dict' object has no attribute 'persist_directory'
```
Esto ocurre incluso en un entorno virtual limpio, con solo `chromadb` y `psycopg2-binary` instalados, y con la variable de entorno `POSTGRES_URL` correctamente configurada. El error aparece tanto en Python 3.11 como 3.12.
## Pasos para reproducir
1. Crear entorno virtual limpio con Python 3.11 o 3.12
2. Instalar chromadb (`pip install chromadb==1.0.21` o `0.4.24`) y `psycopg2-binary`
3. Usar el siguiente script mínimo:
```python
import chromadb
from chromadb.config import Settings
import os
settings = Settings(
chroma_db_impl="chromadb.db.impl.postgres.PostgresDB",
is_persistent=True,
persist_directory=None,
anonymized_telemetry=False,
# POSTGRES_URL debe estar en el entorno
)
try:
client = chromadb.Client(settings)
collection = client.get_or_create_collection("test_pg")
print("Colección creada correctamente")
except Exception as e:
print(f"Error al conectar o crear colección: {e}")
```
## Entorno
- SO: Windows 10/11
- Python: 3.11 y 3.12
- chromadb: 1.0.21 y 0.4.24
- psycopg2-binary: 2.9.10
- POSTGRES_URL: postgresql://user:pass@host:port/db
## Notas
- El error no ocurre con SQLite/local.
- No hay variables de entorno CHROMA* residuales.
- El entorno está limpio de cachés y .pyc.
- El bug bloquea la migración a PostgreSQL.
¿Hay algún workaround o rama donde esté corregido?
---
_Reporte generado automáticamente. Se puede ampliar con logs o detalles adicionales si lo requieren._
### Versions
## Entorno
- SO: Windows 11
- Python: 3.11.9 y 3.12.10
- chromadb: 1.0.21 y 0.4.24
- psycopg2-binary: 2.9.10
- numpy: 1.26.4 y 2.3.2
- PostgreSQL: 15.3
- Instalación: pip en entorno virtual limpio
### Relevant log output
```shell
File "C:\Users\ygarciac\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\chromadb\__init__.py", line 160, in PersistentClient
settings.persist_directory = str(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'persist_directory'
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at chromadb/__init__.py line 160 from the traceback and reproduce the provided Settings and Client flow with PostgreSQL. Trace why settings is a dict when persist_directory is accessed, then verify client and collection creation in the listed Python and ChromaDB versions without the AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100