I am working on a jupyter notebook project which should use spacy. I already used pip install to install spacy in anaconda prompt.
However, when I tried to import spacy, it gives me the follwing error.
I wonder what the problem is and what I can do to solve that.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-96-3173a3034708> in <module>
9 #nltk.download()
10 from nltk.corpus import stopwords
---> 11 import spacy
12
13 #path where we store the txt files
D:\Python\lib\site-packages\spacy\__init__.py in <module>
4
5 # set library-specific custom warning handling before doing anything else
----> 6 from .errors import setup_default_warnings
7
8 setup_default_warnings() # noqa: E402
D:\Python\lib\site-packages\spacy\errors.py in <module>
1 import warnings
----> 2 from .compat import Literal
3
4
5 class ErrorsWithCodes(type):
D:\Python\lib\site-packages\spacy\compat.py in <module>
1 """Helpers for Python and platform compatibility."""
2 import sys
----> 3 from thinc.util import copy_array
4
5 try:
D:\Python\lib\site-packages\thinc\util.py in <module>
6 import functools
7 from wasabi import table
----> 8 from pydantic import create_model, ValidationError
9 import inspect
10 import os
D:\Python\lib\site-packages\pydantic\__init__.cp38-win_amd64.pyd in init pydantic.__init__()
D:\Python\lib\site-packages\pydantic\dataclasses.cp38-win_amd64.pyd in init pydantic.dataclasses()
ImportError: cannot import name dataclass_transform
You can try following codes:
pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_sm
After installation restart the kernal if you are using Jupyter notebook or lab.
It does works for my end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With