ImportError: cannot import name 'deprecated' from 'typing_extensions'


I want to download spacy, but the version of typing-extensions is lowered in the terminal:

ERROR: pydantic 2.3.0 has requirement typing-extensions>=4.6.1, but you'll have typing-extensions 4.4.0 which is incompatible.
ERROR: pydantic-core 2.6.3 has requirement typing-extensions!=4.7.0,>=4.6.0, but you'll have typing-extensions 4.4.0 which is incompatible.
Installing collected packages: typing-extensions
  Attempting uninstall: typing-extensions
    Found existing installation: typing-extensions 4.7.1
    Uninstalling typing-extensions-4.7.1:
      Successfully uninstalled typing-extensions-4.7.1
Successfully installed typing-extensions-4.4.0

Next I want to install the language pack python -m spacy download en, but another error occurs:

(base) E:Anaconda>python -m spacy download en
Traceback (most recent call last):
  File "", line 38, in <module>
    from pydantic.v1 import BaseModel, Extra, ValidationError, create_model
  File "", line 13, in <module>
    from . import dataclasses
  File "", line 11, in <module>
    from ._internal import _config, _decorators, _typing_extra
  File "", line 9, in <module>
    from ..config import ConfigDict, ExtraValues, JsonEncoder, JsonSchemaExtraCallable
  File "", line 9, in <module>
    from .deprecated.config import BaseConfig
  File "", line 6, in <module>
    from typing_extensions import Literal, deprecated
ImportError: cannot import name 'deprecated' from 'typing_extensions' (

My current python version is 3.7, should I update it? Or is there any better solution? I’m a newbie in this area, thank you all!

Asked By: LahliT



You should use typing_extensions==4.7.1

try :

pip install typing_extensions==4.7.1 --upgrade

I also suggest you to upgrade your python version from 3.7 to 3.10 or 3.11

See a relevant answer:

Answered By: Talha Tayyab
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.