Click here to Skip to main content
15,882,552 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I tried importing the NLP library 'Spacy' using import spacy I'm getting the following error:

Python
ImportError: cannot import name 'COMBINING_DIACRITICS' from 'spacy.lang.char_classes'


Here are my versions:

spacy==3.7.2
spacy-legacy==3.0.12

thinc==8.2.2

pydantic==1.8.2
pydantic_core==2.14.6

python version - 3.9.18



Complete error:

ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_33180\572880994.py in 
----> 1 import spacy

c:\Users\anaconda3\lib\site-packages\spacy\__init__.py in 
     11 from thinc.api import Config, prefer_gpu, require_cpu, require_gpu  # noqa: F401
     12 
---> 13 from . import pipeline  # noqa: F401
     14 from . import util
     15 from .about import __version__  # noqa: F401

c:\Users\anaconda3\lib\site-packages\spacy\pipeline\__init__.py in 
----> 1 from .attributeruler import AttributeRuler
      2 from .dep_parser import DependencyParser
      3 from .edit_tree_lemmatizer import EditTreeLemmatizer
      4 from .entity_linker import EntityLinker
      5 from .entityruler import EntityRuler

c:\Users\anaconda3\lib\site-packages\spacy\pipeline\attributeruler.py in 
      6 from .. import util
      7 from ..errors import Errors
----> 8 from ..language import Language
      9 from ..matcher import Matcher
     10 from ..scorer import Scorer
...
      3     ALPHA_LOWER,
      4     ALPHA_UPPER,
      5     COMBINING_DIACRITICS,

ImportError: cannot import name 'COMBINING_DIACRITICS' from 'spacy.lang.char_classes' (c:\Users\anaconda3\lib\site-packages\spacy\lang\char_classes.py)


What I have tried:

I tried installing, uninstalling Spacy, Upgrading the library & all the other common checks. Where is the issue?
Posted

 
Share this answer
 
Fixed the issue by creating a new Conda Environment & installing Spacy.
 
Share this answer
 
Comments
Richard MacCutchan 17-Jan-24 12:46pm    
That won't make any difference if the import does not include all the correct parts. Also Python has its own built in virtual environment creator: venv — Creation of virtual environments — Python 3.11.7 documentation[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900