質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

機械学習

機械学習は、データからパターンを自動的に発見し、そこから知能的な判断を下すためのコンピューターアルゴリズムを指します。人工知能における課題のひとつです。

Q&A

解決済

1回答

5877閲覧

spacy.load('en')が実行できない

zundokokiyoshi

総合スコア18

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

機械学習

機械学習は、データからパターンを自動的に発見し、そこから知能的な判断を下すためのコンピューターアルゴリズムを指します。人工知能における課題のひとつです。

0グッド

1クリップ

投稿2019/02/10 12:17

Jupyter notebookで下記のコードを実行すると、次のようなエラーがでます。

python3

1import spacy 2en_nlp = spacy.load('en')

### OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

このような場合はどのように対処すればよろしいでしょうか?

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

モデルのダウンロードが済んでないことが原因のエラーですね。

このコマンドでモデルをダウンロードして再度同じコードを実行すればエラーが解消します。

$ python3 -m spacy download en

参考: GitHub - explosion/spaCy: ???? Industrial-strength Natural Language Processing (NLP) with Python and Cython

投稿2019/02/11 09:43

編集2019/02/11 09:59
yuokada

総合スコア550

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

zundokokiyoshi

2019/02/11 12:52 編集

ご回答ありがとうございます。 回答していただいたようにコマンドを入力したのですが 「ダウンロードは成功したが、リンク作成に失敗した」というようなコメントがでてうまくいきませんでした。。。 (base) C:\Users\xxxx>python3 -m spacy download en 'python3' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 (base) C:\Users\xxxx>python -m spacy download en Requirement already satisfied: en_core_web_sm==2.0.0 from https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz#egg=en_core_web_sm==2.0.0 in c:\users\xxxx\anaconda3\lib\site-packages You are using pip version 9.0.1, however version 19.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. Error: Couldn't link model to 'en' Creating a symlink in spacy/data failed. Make sure you have the required permissions and try re-running the command as admin, or use a virtualenv. You can still import the model as a module and call its load() method, or create the symlink manually. C:\Users\xxxx\Anaconda3\lib\site-packages\en_core_web_sm --> C:\Users\xxxx\Anaconda3\lib\site-packages\spacy\data\en Creating a shortcut link for 'en' didn't work (maybe you don't have admin permissions?), but you can still load the model via its full package name: nlp = spacy.load('{name}') Download successful but linking failed
yuokada

2019/02/11 13:51

``` Error: Couldn't link model to 'en' Creating a symlink in spacy/data failed. Make sure you have the required permissions and try re-running the command as admin, or use a virtualenv. You can still import the model as a module and call its load() method, or create the symlink manually. ``` パーミッションが足りない旨のエラーメッセージですね。 自分Windows + anaconda環境については知見がないのでググるか他の方に解法を委ねたいと思います。
zundokokiyoshi

2019/02/11 14:44

パスもやってみてうまくいきませんでしたが、下記のぺージを参考にコマンドを入力したら上手くいきました!!! https://github.com/explosion/spaCy/issues/1721 丁寧に回答していただきありがとうございました!!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問