尽管下载了模型“ fr”却找不到

时间:2019-04-30 16:15:00

标签: python python-3.x spacy

嗨!我正在尝试用法语安装SpaCy,但出现了一些问题。确实,在使用pip install -U spacy安装spaCy之后,即使我使用python -m spacy download fr下载了法语模型,也无法调用它,因为它返回了以下错误消息:

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

这是完整的错误消息:

# copy-paste the error message here
(booenv) C:\Users\antoi\Documents\Programming\PACO\bookchatbot>python -m spacy download fr
Requirement already satisfied: fr_core_news_sm==2.1.0 from https://github.com/explosion/spacy-models/releases/download/fr_core_news_sm-2.1.0/fr_core_news_sm-2.1.0.tar.gz#egg=fr_core_news_sm==2.1.0 in c:\users\antoi\documents\programming\paco\bookchatbot\booenv\lib\site-packages (2.1.0)
You are using pip version 10.0.1, however version 19.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
✔ Download and installation successful
You can now load the model via spacy.load('fr_core_news_sm')
You do not have sufficient privilege to perform this operation.
✔ Linking successful
C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\fr_core_news_sm
-->
C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\spacy\data\fr
You can now load the model via spacy.load('fr')

(booenv) C:\Users\antoi\Documents\Programming\PACO\bookchatbot>python -m rasa_nlu.train -c nlu_config.yml --data nlu.md -o models --fixed_model_name nlu --project current --verbose
C:\Python37\lib\runpy.py:125: RuntimeWarning: 'rasa_nlu.train' found in sys.modules after import of package 'rasa_nlu', but prior to execution of 'rasa_nlu.train'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
2019-04-30 15:21:55 WARNING  rasa_nlu.config  - You have specified the pipeline template 'spacy_sklearn' which has been renamed to 'pretrained_embeddings_spacy'. Please update your code as it will no longer work with future versions of Rasa NLU.
2019-04-30 15:21:55 INFO     rasa_nlu.utils.spacy_utils  - Trying to load spacy model with name 'fr'
Traceback (most recent call last):
  File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\rasa_nlu\train.py", line 173, in <module>
    num_threads=cmdline_args.num_threads)
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\rasa_nlu\train.py", line 136, in train
    trainer = Trainer(nlu_config, component_builder)
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\rasa_nlu\model.py", line 150, in __init__
    self.pipeline = self._build_pipeline(cfg, component_builder)
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\rasa_nlu\model.py", line 162, in _build_pipeline
    component = component_builder.create_component(component_cfg, cfg)
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\rasa_nlu\components.py", line 448, in create_component
    component_config, cfg)
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\rasa_nlu\registry.py", line 186, in create_component_by_config
    return component_class.create(component_config, config)
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\rasa_nlu\utils\spacy_utils.py", line 64, in create
    nlp = spacy.load(spacy_model_name, disable=['parser'])
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\spacy\__init__.py", line 27, in load
    return util.load_model(name, **overrides)
  File "C:\Users\antoi\Documents\Programming\PACO\bookchatbot\booenv\lib\site-packages\spacy\util.py", line 136, in load_model
    raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'fr'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

我敢打赌,问题出在我使用的是python3.7而不是3.6

如何重现问题

在实现this Rasa chatbot的情况下,我正在这样做。我将模型从英语更改为法语,并修改了nlu_config.yml file

我的环境

并将结果复制粘贴到此处。-->

  • 空间版本: 2.1.3
  • 平台:Windows-10-10.0.17134-SP0
  • Python版本: 3.7.1
  • 环境信息:

0 个答案:

没有答案