-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Pip and conda install pydantic 2.0.2 by default, that causes ImportError #18027
Comments
From pydantic/pydantic#6381, it seems that |
Seems to be fixed by #18022 |
I solved this issue by degrading |
Thanks everyone. We are aware, the fix is in #18018 and 2.0.5 will be released very shortly. Downgrading the package is the immediate solution. |
@awaelchli Hi, it seems that the conda-forge build of 2.0.5 is failed due to this error: conda-forge/lightning-feedstock#8. |
I believe the correct fix is here: #18030 @Borda This commit was missed in the 2.0.5 release. @function2-llx The solution is to downgrade pydantic to < 2.0 until Lightning 2.0.6 is released. |
@function2-llx, I've pinned |
And don't forget to uninstall I just use |
|
strange as we fixed 2626bf6 and released in UPDATE: can you share your trace as I am not able to reproduce it
|
I'm also getting a pydantic.errors.PydanticUserError, see attached a traceback when I try to import lightning. UPDATE: Based on @silverlining21 comment, I install pydantic==1.10.11 and that gets rid of the error. |
seems something strange with mlflow as the trace states
|
I have similar issue, pytorch-lightning 2.0.8 pyhd8ed1ab_0 defaults |
Facing the same issue. Maybe it's better to reopen this? |
Another set of patches was landed on master in #18676 so pls try install from master |
Bug description
I am developing library that requires lightning dependency. I am trying to build it using conda-build, but it crashes on testing with error
ImportError: cannot import name 'ModelMetaclass' from 'pydantic.main'
. It also crashes with the same error when I tried to test it with tox in appveyor in python 3.8, 3.9, 3.10 and 3.11 on both windows and ubuntu.I also tried to create new clean venv in pycharm, install lightning via pip and
import lightning
shows the same error.Looks like pip and conda install pydantic 2.0.2 by default, but in this version 'ModelMetaclass' is not located in 'pydantic.main' anymore.
Manual installation of pydantic <2.0 or adding requirement
pydantic <2.0
to requirements in my setup.py and meta.yaml fixes the problem.UPD: also I found out that in wheel from pypi in METADATA file pydantic dependency is
Requires-Dist: pydantic (<4.0,>=1.7.4)
, in tar.gz from pypi in requirements/base.txt it ispydantic<3.0,>=1.7.4
and in requirements/app/base.txt it ispydantic >=1.7.4, <2.0.0
.conda search lightning --info
also shows dependency- pydantic <4.0,>=1.7.4
. I think it was supposed to be <2.0, not <4.0?What version are you seeing the problem on?
v2.0
How to reproduce the bug
Error messages and logs
Environment
pip list after
pip install lightning
in clean venvsetup.py with requirements
meta.yaml for conda-build
appveyor.yml
More info
No response
cc @tchaton
The text was updated successfully, but these errors were encountered: