Hi there, I’ve been looking all over for similar posts but can’t seem to find anything that fits my issue. I’ve run the following in order to set up a local Jupyter environment using Anaconda:
This runs without any visible hitch, but when opening a new notebook and running the following line:
from fastai import datasets
I get the error in the title of the post. Sure enough, if I inspect the __init__.py in the error source, which points to the local fastai installation, the file is empty except for the declaration of the version number. I’m not sure how to fix this error, any help would be greatly appreciated!
I’m running on Mac Catalina, version 10.15.7 if this helps
You are creating an environment called fastai there, but you aren’t actually installing fastai from what I can see. I would try just doing import fastai to confirm that and if that is confirmed, you should do
Thank you for your answer
I think that the main problem is that it may have some security issue of the OS. Since I am using Mac BigSur 11.4 but I am unable to locate this.
For now, I just tried for now to re-run this from the course dl2:
#export
from pathlib import Path
from IPython.core.debugger import set_trace
from fastai import datasets
import pickle, gzip, math, torch, matplotlib as mpl
import matplotlib.pyplot as plt
from torch import tensor
and it stops where I import datasets from fastai. If I substitute
’ from fastai import datasets ’ with ’ from fastai import * ’
it complains at the next line:
I’m also running Mac Big Sur, and I don’t think you have a security issue. I think you have a version mismatch issue. The code you’re attempting to run appears to expect an earlier version of fastai. When I run that same code excerpt on my machine, I get the same error, which I expect.
I think you need to clarity what version of fastai your code expects, or whether you want to modify your code for the current version (2.4.1).
For example, you should be able to use
from fastai.data.all import *
path = untar_data(URLs.MNIST)
to download the data your current code is erroring on. But again, you’ll run into more version errrors further down in your code unless you figure out whether you 1) want to use an earlier version of fastai or 2) update the code to use the current version. I’d recommend 2).
I hope not to need to revert to v1 to make it work streamline. I would be surprised since this is what is in the notebooks of the course ‘from the foundations’ of v3. In case, is there a way that you are aware of to have two versions installed?