Skip to content
TheChatArchiveThe Chat Archive
GeminiGemini (model unspecified)· GoogleHugging Face ShareLM (browser-extension contributions)

help Traceback (most recent call last): File…

  1. User

    help Traceback (most recent call last): File "/home/esther/PycharmProjects/edut710/pheonix_backup/edut710/holocaust_references/running_on_ivritai_trans/preprocess.py", line 5, in import spacy File "/XXX.10/site-packages/spacy/init.py", line 11, in from thinc.api import prefer_gpu, require_gpu, require_cpu # noqa: F401 File "/XXX.10/site-packages/thinc/init.py", line 5, in from .config import registry File "/XXX.10/site-packages/thinc/config.py", line 11, in from pydantic.main import ModelMetaclass ImportError: cannot import name 'ModelMetaclass' from 'pydantic.main' (/XXX.10/site-packages/pydantic/main.py)

  2. Gemini Assistant

    This error is caused by a version conflict between spacy and pydantic.Specifically, your installed version of spacy (via its dependency thinc) expects Pydantic v1, but you likely have Pydantic v2 installed. Pydantic v2 introduced breaking changes, removing ModelMetaclass from the location thinc is looking for.Here are two ways to fix this:Option 1: Upgrade SpaCy (Recommended)Newer versions of SpaCy (v3.7+) have been updated to support Pydantic v2. Try upgrading your SpaCy installation:Bashpip install -U spacy Option 2: Downgrade Pydantic (Quick Fix)If you cannot upgrade SpaCy (e.g., due to other dependencies), you must downgrade Pydantic to a version below 2.0:Bashpip install "pydantic<2.0.0" Next Step: Run one of the commands above in your terminal (make sure your virtual environment venv is active) and try running your script again.