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】reflex init error #4606

Open
jfxia opened this issue Jan 8, 2025 · 2 comments
Open

【BUG】reflex init error #4606

jfxia opened this issue Jan 8, 2025 · 2 comments

Comments

@jfxia
Copy link

jfxia commented Jan 8, 2025

Describe the bug
After pip install reflex ,run reflex init, an error occurs:

Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users\mypc\AppData\Local\Programs\Python\Python312\Scripts\reflex.exe_main
.py", line 4, in
File "C:\Users\mypc\AppData\Local\Programs\Python\Python312\Lib\site-packages\reflex\reflex.py", line 16, in
from reflex.state import reset_disk_state_manager
File "C:\Users\mypc\AppData\Local\Programs\Python\Python312\Lib\site-packages\reflex\state.py", line 326, in
class BaseState(Base, ABC, extra=pydantic.Extra.allow):
File "C:\Users\mypc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pydantic\v1\main.py", line 286, in new
cls.try_update_forward_refs()
File "C:\Users\mypc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pydantic\v1\main.py", line 807, in try_update_forward_refs
update_model_forward_refs(cls, cls.fields.values(), cls.config.json_encoders, localns, (NameError,))
File "C:\Users\mypc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pydantic\v1\typing.py", line 554, in update_model_forward_refs
update_field_forward_refs(f, globalns=globalns, localns=localns)
File "C:\Users\mypc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pydantic\v1\typing.py", line 520, in update_field_forward_refs
field.type
= evaluate_forwardref(field.type_, globalns, localns or None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mypc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pydantic\v1\typing.py", line 66, in evaluate_forwardref
return cast(Any, type_)._evaluate(globalns, localns, set())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'

To Reproduce
Steps to reproduce the behavior:
In Win10 cmd console, run reflex init

Specifics (please complete the following information):

  • Python Version: 3.12
  • Reflex Version: 0.6.7
  • OS: Windows 10
Copy link

linear bot commented Jan 8, 2025

@szew404
Copy link

szew404 commented Jan 8, 2025

The error is related to the version of Pydantic.

In python 3.12.0 - 3.12.3, the new version pydantic-1.10.20 does not work with annotations of type forward ref.

Downgrading to pydantic-1.10.19 does not throw exception.

Try adding the following to your requirements.txt:
pydantic==1.10.19

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

No branches or pull requests

3 participants