Closed lee212 closed 3 years ago
Changing PyTorch virtual environment from python-3.8.10 to python-3.6.12 solved the issue as the required version is older than 3.7 (https://github.com/samuelcolvin/pydantic/blob/master/requirements.txt)
I believe pydantic is supported in all Python versions greater than or equal to 3.6+, see the the readme: https://github.com/samuelcolvin/pydantic#pydantic
And see pypi: https://pypi.org/project/pydantic/
I'm not exactly sure what the python_version < '3.7'
requirement does, but perhaps it is not use to build the released versions.
Here is a test case that verifies the latest version of pydantic in Python 3.7:
$ python -V
Python 3.7.4
$ python -m venv env
$ source env/bin/activate
(env) $ pip install pydantic
Collecting pydantic
Downloading https://files.pythonhosted.org/packages/ff/74/54e030641601112309f6d2af620774e9080f99c7a15742fc6a0b170c4076/pydantic-1.8.2-py3-none-any.whl (126kB)
100% |████████████████████████████████| 133kB 7.9MB/s
Collecting typing-extensions>=3.7.4.3 (from pydantic)
Using cached https://files.pythonhosted.org/packages/2e/35/6c4fff5ab443b57116cb1aad46421fb719bed2825664e8fe77d66d99bcbc/typing_extensions-3.10.0.0-py3-none-any.whl
Installing collected packages: typing-extensions, pydantic
Successfully installed pydantic-1.8.2 typing-extensions-3.10.0.0
You are using pip version 19.0.3, however version 21.1.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(env) $ python
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pydantic
>>> pydantic.VERSION
'1.8.2'
>>> from pydantic import root_validator, validator
>>>
This could point to another issue with the conda environment.
You're right there must have been something wrong with the installation onto that conda environment, I ended up making a new one which seemed to work. Also, we checked this before as well but importing root_validator
and validator
from pydantic seemed to work in terminal regardless of which environment was activated but threw the error running on the cluster. I'm not sure if this is relevant but in the __init__.py
file that it was complaining about before, the root_validator
module wasn't actually imported from .class_validators
but in the new installation it is.
Glad it is working now. I'll close the issue, but feel free to reopen if the error pops up again.
In the course of testing DDMD on Bridges2, this is observed: