zeno-ml / zeno

AI Data Management & Evaluation Platform
https://zenoml.com
MIT License
215 stars 11 forks source link

Pydantic error on clean install of Zeno #938

Closed neubig closed 1 year ago

neubig commented 1 year ago

I'm getting an error regarding pydantic on a clean install of zeno. Reproduction method:

$ conda create --name=zeno_clean python=3.10
$ conda activate zeno_clean
$ pip install zenoml
$ python
>>> from zeno import DistillReturn, MetricReturn, ZenoOptions, distill, metric

Result:

$ python
Python 3.10.12 (main, Jul  5 2023, 15:02:25) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from zeno import DistillReturn, MetricReturn, ZenoOptions, distill, metric
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/gneubig/anaconda3/envs/zeno_clean/lib/python3.10/site-packages/zeno/__init__.py", line 1, in <module>
    from zeno.api import (
  File "/Users/gneubig/anaconda3/envs/zeno_clean/lib/python3.10/site-packages/zeno/api.py", line 38, in <module>
    class ZenoParameters(BaseModel):
  File "/Users/gneubig/anaconda3/envs/zeno_clean/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 98, in __new__
    private_attributes = inspect_namespace(
  File "/Users/gneubig/anaconda3/envs/zeno_clean/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 347, in inspect_namespace
    raise PydanticUserError(
pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `calculate_histogram_metrics = True`. All model fields require a type annotation; if `calculate_histogram_metrics` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.

For further information visit https://errors.pydantic.dev/2.1.1/u/model-field-missing-annotation
cabreraalex commented 1 year ago

Hmm thought this was just my install, apparently it's breaking with Pydantic >= 2.0.0 . If you install Pydantic at a version below 2.0.0 does it work?

neubig commented 1 year ago

Ah, yes.

pip install "pydantic<2.0.0"

fixed the issue!