반응형
OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a Python package or a valid path to a data directory.¶
nlp = spacy.load('en_core_web_sm')
을 실행하면 아래와 같은 에러가 나타날 수 있습니다¶
In [1]:
import spacy
nlp = spacy.load('en_core_web_sm')
2023-09-19 20:03:35.425924: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT /home/jin/anaconda3/lib/python3.9/site-packages/scipy/__init__.py:146: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.24.3 warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
--------------------------------------------------------------------------- OSError Traceback (most recent call last) /tmp/ipykernel_2370874/1795512589.py in <module> 1 import spacy ----> 2 nlp = spacy.load('en_core_web_sm') ~/anaconda3/lib/python3.9/site-packages/spacy/__init__.py in load(name, vocab, disable, enable, exclude, config) 49 RETURNS (Language): The loaded nlp object. 50 """ ---> 51 return util.load_model( 52 name, 53 vocab=vocab, ~/anaconda3/lib/python3.9/site-packages/spacy/util.py in load_model(name, vocab, disable, enable, exclude, config) 470 if name in OLD_MODEL_SHORTCUTS: 471 raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name])) # type: ignore[index] --> 472 raise IOError(Errors.E050.format(name=name)) 473 474 OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a Python package or a valid path to a data directory.
아래 명령어를 통해 english를 다운받고 nlp = spacy.load('en_core_web_sm')
을 다시 실행하면 에러가 해결됩니다.¶
In [2]:
!python -m spacy download en
2023-09-19 20:05:54.219940: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT /home/jin/anaconda3/lib/python3.9/site-packages/scipy/__init__.py:146: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.24.3 warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}" ⚠ As of spaCy v3.0, shortcuts like 'en' are deprecated. Please use the full pipeline package name 'en_core_web_sm' instead. Collecting en-core-web-sm==3.6.0 Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.6.0/en_core_web_sm-3.6.0-py3-none-any.whl (12.8 MB) |████████████████████████████████| 12.8 MB 161 kB/s eta 0:00:01 |███████████▊ | 4.7 MB 1.4 MB/s eta 0:00:06[K |████████████████████ | 8.0 MB 161 kB/s eta 0:00:30 Requirement already satisfied: spacy<3.7.0,>=3.6.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from en-core-web-sm==3.6.0) (3.6.1) Requirement already satisfied: typer<0.10.0,>=0.3.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (0.9.0) Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (6.4.0) Requirement already satisfied: pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2.3.0) Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (1.0.10) Requirement already satisfied: packaging>=20.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (21.0) Requirement already satisfied: pathy>=0.10.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (0.10.2) Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (3.3.0) Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2.0.9) Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (1.0.5) Requirement already satisfied: requests<3.0.0,>=2.13.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2.26.0) Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (3.0.9) Requirement already satisfied: spacy-legacy<3.1.0,>=3.0.11 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (3.0.12) Requirement already satisfied: thinc<8.2.0,>=8.1.8 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (8.1.12) Requirement already satisfied: srsly<3.0.0,>=2.4.3 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2.4.7) Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2.0.8) Requirement already satisfied: numpy>=1.15.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (1.24.3) Requirement already satisfied: jinja2 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2.11.3) Requirement already satisfied: setuptools in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (58.0.4) Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (4.62.3) Requirement already satisfied: wasabi<1.2.0,>=0.9.1 in /home/jin/anaconda3/lib/python3.9/site-packages (from spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (1.1.2) Requirement already satisfied: pyparsing>=2.0.2 in /home/jin/anaconda3/lib/python3.9/site-packages (from packaging>=20.0->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (3.0.4) Requirement already satisfied: annotated-types>=0.4.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (0.5.0) Requirement already satisfied: typing-extensions>=4.6.1 in /home/jin/anaconda3/lib/python3.9/site-packages (from pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (4.8.0) Requirement already satisfied: pydantic-core==2.6.3 in /home/jin/anaconda3/lib/python3.9/site-packages (from pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2.6.3) Requirement already satisfied: idna<4,>=2.5 in /home/jin/anaconda3/lib/python3.9/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (3.2) Requirement already satisfied: charset-normalizer~=2.0.0 in /home/jin/anaconda3/lib/python3.9/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2.0.4) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/jin/anaconda3/lib/python3.9/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (1.26.7) Requirement already satisfied: certifi>=2017.4.17 in /home/jin/anaconda3/lib/python3.9/site-packages (from requests<3.0.0,>=2.13.0->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (2021.10.8) Requirement already satisfied: confection<1.0.0,>=0.0.1 in /home/jin/anaconda3/lib/python3.9/site-packages (from thinc<8.2.0,>=8.1.8->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (0.1.3) Requirement already satisfied: blis<0.8.0,>=0.7.8 in /home/jin/anaconda3/lib/python3.9/site-packages (from thinc<8.2.0,>=8.1.8->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (0.7.10) Requirement already satisfied: click<9.0.0,>=7.1.1 in /home/jin/anaconda3/lib/python3.9/site-packages (from typer<0.10.0,>=0.3.0->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (8.0.3) Requirement already satisfied: MarkupSafe>=0.23 in /home/jin/anaconda3/lib/python3.9/site-packages (from jinja2->spacy<3.7.0,>=3.6.0->en-core-web-sm==3.6.0) (1.1.1) Installing collected packages: en-core-web-sm Successfully installed en-core-web-sm-3.6.0 ✔ Download and installation successful You can now load the package via spacy.load('en_core_web_sm')
In [3]:
nlp = spacy.load('en_core_web_sm')
반응형
댓글