ImportError when trying to import PydanticValueError from pydantic
Closed this issue · 2 comments
giuliosmall commented
Description
When trying to execute dbt2looker
from a virtual environment, I encountered an ImportError
related to the pydantic
package. The error occurs when attempting to import PydanticValueError
from pydantic
.
Steps to Reproduce
python3.11 -m venv dbt2looker-venv
source dbt2looker-venv/bin/activate
pip install dbt2looker
dbt2looker
- Observe the error during the import process.
Expected Behavior
The dbt2looker
tool should start without any import errors.
Actual Behavior
The following ImportError is thrown:
Traceback (most recent call last):
File "/Users/username/Projects/dbt/dbt2looker-venv/bin/dbt2looker", line 5, in <module>
from dbt2looker.cli import run
File "/Users/username/Projects/dbt/dbt2looker-venv/lib/python3.11/site-packages/dbt2looker/cli.py", line 18, in <module>
from . import parser
File "/Users/username/Projects/dbt/dbt2looker-venv/lib/python3.11/site-packages/dbt2looker/parser.py", line 5, in <module>
from . import models
File "/Users/username/Projects/dbt/dbt2looker-venv/lib/python3.11/site-packages/dbt2looker/models.py", line 7, in <module>
from pydantic import BaseModel, Field, PydanticValueError, validator
ImportError: cannot import name 'PydanticValueError' from 'pydantic' (/Users/username/Projects/dbt/dbt2looker-venv/lib/python3.11/site-packages/pydantic/init.py)
Additional Information
- Python Version:
3.11
- dbt2looker Version:
0.11.0
- Operating System:
macOS Sonoma 14.4.1
- Installation Method:
pip
giuliosmall commented
Tested with python 3.7.16
with the following packages installed in a conda venv:
Package Version
------------------ ---------
annotated-types 0.5.0
certifi 2022.12.7
dbt2looker 0.11.0
importlib-metadata 6.7.0
lkml 1.3.4
pip 22.3.1
pydantic 2.5.3
pydantic_core 2.14.6
PyYAML 6.0.1
setuptools 65.6.3
typing_extensions 4.7.1
wheel 0.38.4
zipp 3.15.0
Got the same error:
Traceback (most recent call last):
File "/Users/username/anaconda3/envs/dbt2looker/bin/dbt2looker", line 5, in <module>
from dbt2looker.cli import run
File "/Users/username/anaconda3/envs/dbt2looker/lib/python3.7/site-packages/dbt2looker/cli.py", line 18, in <module>
from . import parser
File "/Users/username/anaconda3/envs/dbt2looker/lib/python3.7/site-packages/dbt2looker/parser.py", line 5, in <module>
from . import models
File "/Users/username/anaconda3/envs/dbt2looker/lib/python3.7/site-packages/dbt2looker/models.py", line 7, in <module>
from pydantic import BaseModel, Field, PydanticValueError, validator
ImportError: cannot import name 'PydanticValueError' from 'pydantic' (/Users/username/anaconda3/envs/dbt2looker/lib/python3.7/site-packages/pydantic/__init__.py)
giuliosmall commented
pip install dbt2looker
will install pydantc 2.7.0
as dependency which no longer supports 'PydanticValueError' .
pip uninstall pydantic
pip install pydantic==1.10.2
will solve the above ImportError