ModuleNotFoundError: No module named 'allennlp.commands.elmo'

Viewed 4781

I installed the allennlp package by using pip install allennlp. But when I tried to import it from Jupyter Notebook using this command from allennlp.commands.elmo import ElmoEmbedder, it gave me an error ModuleNotFoundError: No module named 'allennlp.commands.elmo'. I am wondering how should I fix this, I have the Python 3.7 installed and Spacy installed as well but for some reasons, I just cannot import the ElmoEmbedder

1 Answers

The current version of allennlp (1.0.0) does not contain the elmo.py file. Install it using

pip install allennlp==0.4.2

This will install version 0.4.2 which contains ElmoEmbedder. Installing this version of allennlp requires older versions of a lot of python packages (for example, torch 0.3.1 is needed), so i'd recommend installing it in a virtual environment.

Related