No module named 'fastai' error in create_toks.py


(Matt) #1

Hello!
So I recently downloaded and set up the fastai repository by following the associated instructions on github. I am currently trying to get lesson 11 going, but when I attempt to run create_toks.py as mentioned in the imdb_scripts part of the repo, I get the following error:
Traceback (most recent call last):
File “create_toks.py”, line 1, in
from fastai.text import *
ModuleNotFoundError: No module named ‘fastai’
The strange thing about this is that even when I attempt to add the directory where text.py is located, the error is still not solved. I have also tried running the unit tests, which seem to require bits of the fatai module, and they work while create_toks.py does not. I setup this project on Ubuntu 16.04. Is there anything that I can look into next?
Thanks!


(Matt) #2

Also,I ran into this error after successfully starting up the fastai conda environment and running create_toks.py while it was going.


(Samuel) #3

Please try . or .. that directs to the fastai folder
Example

from .fastai.text import *


(Matt) #4

‘…’ Gives the following error:
Traceback (most recent call last):
File “create_toks.py”, line 1, in
from …fastai.text import *
ValueError: attempted relative import beyond top-level package

‘.’ Gives the following error:
Traceback (most recent call last):
File “create_toks.py”, line 1, in
from .fastai.text import *
ModuleNotFoundError: No module named ‘main.fastai’; ‘main’ is not a package


(Matt) #5

Also,
Using ‘…’ Gives the following error:
Traceback (most recent call last):
File “create_toks.py”, line 1, in
from …fastai.text import *
ValueError: attempted relative import beyond top-level package