'fire' import in error when running fastai/courses/dl2/imdb_scripts/finetune_lm.py

I am following https://github.com/fastai/fastai/blob/master/courses/dl2/imdb_scripts/README.md

Here is my command line:
python finetune_lm.py data/imdb data/wt103 1 25 --lm-id pretrain_wt103

Here is the error (Google did not give any interesting solution about the problem):

Traceback (most recent call last):
File “finetune_lm.py”, line 1, in
import fire
ModuleNotFoundError: No module named ‘fire’

I installed fast.ai on an AWS virtual machine, by following this post: Fastai v0.7 install issues thread
In my environment, the notebook https://github.com/fastai/fastai/tree/master/courses/dl2/imdb.ipynb is working fine, which shows that my install is “fine”. (the notebook does not contain that ‘import fire’ statement, contrary to the .py file)

you need to install fire
pip install fire to run the scripts


Ok thx. Now I get this:

ModuleNotFoundError: No module named 'fastai'

The notebook runs fine, because the required ‘fastai.text’ python files are located in the same folder as the notebook (‘fastai/courses/dl2/fastai/text’).
But finetune_lm.py is in folder ‘fastai/courses/dl2/imdb_scripts’, and does not see the ‘fastai.text…’ files

What do I have to do, please ?

based on my experience, you have to install
I think this must be done using pip.
the imdb_scripts code on github maybe deprecated
it doesn’t work with latest fastai

try pip install fastai==0.7.0

1 Like