fastai.vision Import Error: How to fix the import error so I can use ImageDataBunch.from_folder?
I'm working on google colab ( python 3.6 and GPU), I import torch (1.2.0) nicely and I use the following to import fastai: 

    import fastai
    print(fastai.__version__)
    from fastai import *
    from fastai.vision import *


I get the following error:

ImportError: /usr/local/lib/python3.6/dist-packages/torchvision/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c106Device8validateEv

I have tried to install different torch versions like 1.0.0 and work with earlier python versions. I have also tried to install fastai and its dependencies manually using !pip, but nothing worked. 

This is the complete code I used to install torch: 

    from os.path import exists
    from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag

    platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), 
    get_abi_tag())
    cuda_output = !ldconfig -p|grep cudart.so|sed -e 's/.*\.\([0-9]*\)\.\ 
    ([0-9]*\)$/cu\1\2/'
    accelerator = cuda_output[0] if exists('/dev/nvidia0') else 'cpu'

    !pip install torch_nightly -f 
 https://download.pytorch.org/whl/nightly/{accelerator}/torch_nightly.html
    !pip install fastai

   import torch

   print(torch.__version__)
   print(torch.cuda.is_available())
   print(torch.backends.cudnn.enabled)


And this is the full error message I get:

    ImportError                                                           
    Traceback (most recent call last)
    &lt;ipython-input-5-4b8b8d8134df&gt; in &lt;module&gt;()
  2 print(fastai.__version__)
  3 from fastai import *
  ----&gt; 4 from fastai.vision import *
    8 frames
  /usr/local/lib/python3.6/dist-packages/torchvision/ops/boxes.py in 
  &lt;module&gt;()
  1 import torch
  ----&gt;  2 from torchvision import _C
  3 
  4 
  5 def nms(boxes, scores, iou_threshold):

  ImportError: /usr/local/lib/python3.6/dist- 
  packages/torchvision/_C.cpython-36m-x86_64-linux-gnu.so: undefined 
  symbol: _ZN3c106Device8validateEv


I'm unable to use ImageDataBunch.from_folder because of this fastai import error. I get the error NameError: name 'ImageDataBunch' is not defined when I do.

Note: I did use the same code before and I was able to use fastai and  ImageDataBunch.from_folder with no import errors , but I'm guessing that an update to fastai or torch happened.

You don't need to install PyTorch first when you use FastAi, it will do it for you.
If you need latest FastAi do this:

pip3 install git+https://github.com/fastai/fastai.git

