Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error with dependency on pydantic >v2 needs addressing #372

Open
Analect opened this issue Jul 22, 2023 · 1 comment
Open

[BUG] Error with dependency on pydantic >v2 needs addressing #372

Analect opened this issue Jul 22, 2023 · 1 comment

Comments

@Analect
Copy link

Analect commented Jul 22, 2023

Describe the bug
I was playing around with getting an interactive-app working, per your docs

To Reproduce
Create a test.py with this code from link above.

import meerkat as mk

@mk.reactive()
def square(a: float) -> float:
    return a**2


@mk.reactive()
def multiply(coef: float, a: float) -> float:
    return coef * a


@mk.endpoint()
def increment(value: mk.Store):
    value.set(value + 1)


input_slider = mk.gui.Slider(value=2.0)
coef_slider = mk.gui.Slider(value=2.0)

squared_value = square(input_slider.value)
result = multiply(coef_slider.value, squared_value)

button = mk.gui.Button(
    title="Increment", on_click=increment.partial(value=input_slider.value)
)

page = mk.gui.Page(
    component=mk.gui.html.div([input_slider, coef_slider, button, mk.gui.Text(result)]),
    id="quickstart",
)
page.launch()

Then run python test.py.

You get an error:

ImportError: cannot import name 'ModelField' from 'pydantic.fields' (/home/xxxx/miniconda3/lib/python3.9/site-packages/pydantic/fields.py)

It seems from this issue, ModelField no longer exists since V2 of pydantic. The above works, if I force an install of an earlier version of pydantic. (pip install pydantic==1.10.11).

Given that the default version of pydantic is >2, this will need fixing

System Information

  • OS: ubuntu linux
@thompsonmj
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants