Installation in virtual environment

Hi all,

I installed Prodigy 1.10.6 in a virtual environment with Python 3.8 (Ubuntu 20.04.02 LTE). When running textcat.manual I get this error message (full traceback at the end)
" from pydantic import validator, BaseModel, Field, Schema
ImportError: cannot import name 'Schema' from 'pydantic' (/home/ahe/Venvs/Leydenlabs/venv-llabs/lib/python3.8/site-packages/pydantic/init.cpython-38-x86_64-linux-gnu.so)

When installing Prodigy in the normal environment everything works fine

thanks,

Andreas

===
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.8/runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.8/runpy.py", line 111, in _get_module_details
import(pkg_name)
File "/home/ahe/Venvs/Leydenlabs/venv-llabs/lib/python3.8/site-packages/prodigy/init.py", line 7, in
from . import recipes
File "/home/ahe/Venvs/Leydenlabs/venv-llabs/lib/python3.8/site-packages/prodigy/recipes/init.py", line 4, in
from ..deprecated import recipes # noqa
File "/home/ahe/Venvs/Leydenlabs/venv-llabs/lib/python3.8/site-packages/prodigy/deprecated/recipes.py", line 9, in
from ..core import recipe
File "cython_src/prodigy/core.pyx", line 12, in init prodigy.core
File "cython_src/prodigy/components/feeds.pyx", line 8, in init prodigy.components.feeds
File "/home/ahe/Venvs/Leydenlabs/venv-llabs/lib/python3.8/site-packages/prodigy/components/validate.py", line 5, in
from ..types import TextTask, ClassificationTask, ImageTask, SpansTask, SpansManualTask
File "/home/ahe/Venvs/Leydenlabs/venv-llabs/lib/python3.8/site-packages/prodigy/types.py", line 3, in
from pydantic import validator, BaseModel, Field, Schema
ImportError: cannot import name 'Schema' from 'pydantic' (/home/ahe/Venvs/Leydenlabs/venv-llabs/lib/python3.8/site-packages/pydantic/init.cpython-38-x86_64-linux-gnu.so)

Hi!

This probably happens because pydantic.fields.Schema was deprecated in version 1.8 of Pydantic. In your virtual environment, you could install pydantic==1.7 first, then install Prodigy, and hopefully it should work.

This has been fixed in Prodigy v1.10.7 - the related thread is here for background information: ImportError: cannot import name 'Schema' from 'pydantic'

Let us know if you'd still run into issues though!

Hi Sofie,

thanks, did the trick. Runs like a charm

best,

Andreas

1 Like