-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
python 3.14 compatibility is added in pydantic 2.12.
With this combination, the following is thrown on importing chromadb:
C:\...\site-packages\langchain_core\_api\deprecation.py:26: UserWarning: Core Pydantic V1 functionality isn't compatible with Python 3.14 or greater.
from pydantic.v1.fields import FieldInfo as FieldInfoV1
2.12.3
---
File "C:\...\site-packages\chromadb\__init__.py", line 3, in <module>
from chromadb.api.client import Client as ClientCreator
File "C:\...\site-packages\chromadb\api\__init__.py", line 47, in <module>
from chromadb.config import DEFAULT_DATABASE, DEFAULT_TENANT
File "C:\...\site-packages\chromadb\config.py", line 120, in <module>
class Settings(BaseSettings): # type: ignore
...<207 lines>...
env_file_encoding = "utf-8"
File "C:\...\site-packages\pydantic\v1\main.py", line 221, in __new__
inferred = ModelField.infer(
name=var_name,
...<3 lines>...
config=config,
)
File "C:\...\site-packages\pydantic\v1\fields.py", line 504, in infer
return cls(
name=name,
...<7 lines>...
field_info=field_info,
)
File "C:\...\site-packages\pydantic\v1\fields.py", line 434, in __init__
self.prepare()
~~~~~~~~~~~~^^
File "C:\...\site-packages\pydantic\v1\fields.py", line 544, in prepare
self._set_default_and_type()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\...\site-packages\pydantic\v1\fields.py", line 576, in _set_default_and_type
raise errors_.ConfigError(f'unable to infer type for attribute "{self.name}"')
pydantic.v1.errors.ConfigError: unable to infer type for attribute "chroma_server_nofile"This is happening due to sunk exception in config.py import section:
in_pydantic_v2 = False
try:
from pydantic import BaseSettings
except ImportError:
in_pydantic_v2 = True
from pydantic.v1 import BaseSettings
from pydantic.v1 import validator
if not in_pydantic_v2:
from pydantic import validator # type: ignore # noqaIt is caused by refactoring in pydantic 2.12, and entering the except block wrongly forces v1 syntax.
Changing the section to the following makes the code runnable, and reveals the deprecation exception:
from pydantic import BaseSettings
from pydantic.v1 import validatorError importing modules: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.12/migration/#basesettings-has-moved-to-pydantic-settings for more details.
For further information visit https://errors.pydantic.dev/2.12/u/import-error
(Note that the above change is not the solution as BaseSettings is no longer there - an additional dependency on pydantic-settings module seems to be required)
Versions
Python 3.14.2
Windows 11
chromadb==1.3.5
pydantic==2.12.3
Relevant log output
Wonder-donbury, huangsam and Alessi0X
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working