Search code examples
pythonfast-ai

is fastai.structured still a part of fast ai library


Why i am getting the error fastai.structured is not a module?.

i have tried installing previous versions of fastai. but nothing helped.

from fastai.imports import *
from fastai.structured import *

#from pandas_summary import DataFrameSummary
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from IPython.display import display

from sklearn import metrics
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-17-35432a48f631> in <module>()
      1 from fastai.imports import *
----> 2 from fastai.structured import *
      3 
      4 #from pandas_summary import DataFrameSummary
      5 from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier

ModuleNotFoundError: No module named 'fastai.structured'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

Solution

  • That module is no longer included in fastai's default python packages. Your default setup commands for using fastai packages will no longer includes that module. You may need to download it from the GitHub master, save it to your working directory, and import from your working directory to your jupyter notebook.

    Here's a note from the fastai forum:

    The structured.py has been moved to folder “old” (in anticipation to fastai_v1). https://github.com/fastai/fastai/blob/master/old/fastai/structured.py --- Andrei Oct '18

    When importing from your working directory:
    from structured import *

    This will replace:
    from fastai.structured import *