Closed PBL-markroelfsema closed 4 months ago
The pydantic version that was installed on my machine is
pydantic 2.7.4 pypi_0 pypi
Thanks for reporting this issue, @PBL-markroelfsema, and sorry for the late reply!
Unfortunately, I'm unable to reproduce your error on my local system. Even after updating to pydantic 2.7.4
, all tests run correctly. So I'm going to need more information to help you solve your problem.
First of, your information about pydantic seems to indicate that it was installed from pypi. Conda and pypi (installing with pip
) don't mix very well and it is generally recommended to use pip
after you installed as much as possible with conda
, and then stay with pip
. Please also see conda's guide on this.
In fact, I don't immediately see why anything other than this mixture might cause your issue. You're using Python 3.11, which is fairly recent, on Windows, which is fine, and your ixmp4 version is recent enough (we still have this exact line in our latest code). Could you please confirm which version of ixmp4 you're using?
It even looks like you're using a virtual environment glasgow_init_env
. So my current best guess is that you installed ixmp4
via conda
, but other packages like pydantic
via pip
and for some reason, the conda
-installed ixmp4
doesn't know where to find those. Because even the latest pydantic
version still has field_validator
importable from its top level. So please make sure to follow the guide and use, if possible, either conda
or pip
in any one virtual environment.
If this makes you want to choose between conda
and pip
, I would highly recommend you use pip
. It is just much more user-friendly in my experience.
Thanks @glatterf42, I have reinstalled my environment avoiding pip, and now it works. So, the confusion between conda and pip must have resulted in the error.
Glad to hear that! I'm closing this issue, if you encounter any other issues, please open a new one :)
When I try to install (via Conda) the ixmp4 package, I get the following error
On StackOverlfow they seem to suggest that the call to pydantic has changed to from pydantic.functional_validators import field_validator https://stackoverflow.com/questions/77172420/importerror-cannot-import-name-field-validator-from-pydantic