Issue when importing

Hello All,
I’ve been trying to get fastai setup in an AWS sagemaker notebook but I keep running into the following traceback error whenever I try to do the following:

from import *
from import *

NameError                                 Traceback (most recent call last)
/tmp/ipykernel_22462/ in <module>
      1 #fastai imports
----> 2 from import *
      3 from   import *

~/anaconda3/envs/amazonei_pytorch_latest_p37/lib/python3.7/site-packages/fastai/vision/ in <module>
----> 1 from . import models
      2 from ..basics import *
      3 from ..callback.all import *
      4 from .augment import *
      5 from .core import *

~/anaconda3/envs/amazonei_pytorch_latest_p37/lib/python3.7/site-packages/fastai/vision/models/ in <module>
----> 1 from . import xresnet
      2 from . import unet
      3 from .tvm import *

~/anaconda3/envs/amazonei_pytorch_latest_p37/lib/python3.7/site-packages/fastai/vision/models/ in <module>
     11 # Cell
---> 12 from ...torch_basics import *
     13 try: from torchvision.models.utils import load_state_dict_from_url
     14 except ModuleNotFoundError: from torch.hub import load_state_dict_from_url

~/anaconda3/envs/amazonei_pytorch_latest_p37/lib/python3.7/site-packages/fastai/ in <module>
      9 from .imports import *
     10 from .torch_imports import *
---> 11 from .torch_core import *
     12 from .layers import *
     13 from .losses import *

~/anaconda3/envs/amazonei_pytorch_latest_p37/lib/python3.7/site-packages/fastai/ in <module>
     30 # Cell
---> 31 @delegates(plt.subplots, keep=True)
     32 def subplots(nrows=1, ncols=1, figsize=None, imsize=3,suptitle=None, **kwargs):
     33     if figsize is None:

NameError: name 'delegates' is not defined

I’ve tried reinstalling fastai with conda, pip, and even using the fastai docker images, but I keep getting this error that seems to traceback to a delegates call in the fastai file in the fastai repo.

Does anyone have any ideas for what could be causing this or how to fix it?

Hey, delegates is a fastcore function, is fastcore installed correctly? I would have thought that conda would install that alongside fastai, what command did you use to install fastai?
If you do have the time, you can check out the Live Coding sessions where Jeremy goes through the installation and setup process in detail.

Hey, thanks for pointing that out. I ended up creating a new environment for fastai and reinstalling everything via conda there. That seems to have solved this issue. Now if I could find an updated object detection walkthrough that goes through using learner.get_preds() that would solve a lot more of my issues…

1 Like