Can't import fastai to local Jupyter notebook

Update? Most likely you are dealing with the same situation 1kastner is describing above in the last post by him and not understanding 1kastner’s advice how to fix.

If you do !pip list | grep fastai and see it on your system, it doesn’t mean Jupyter is able to use that. Jupyter can only use things installed to certain environments unless you otherwise connect it. You don’t tell us how you installed fastai to wherever you installed it; however, it’s concerning that you are using !pip and not %pip. Try this to install it to the environment that Jupyter is using:

  • Open the Jupyter .ipynb file where you want to use fastai in your Jupyter
  • Make a new cell near the top and run %pip install fastai.
  • Let that run entirely and then restart the kernel.
  • It probably isn’t necessary for this package, but if you were installing something more complicated like ipywidgets or an extension, I’d say to even shut down Jupyter and restart it, or at least try refreshing the browser page to let the changes propagate entirely.
  • Finally, when the kernel has been restarted (and the browser page refreshed/Jupyter restarted for complex packages) then try the appropriate import statement. For this case, you can use from fastai.text.all import *, based on one of the many import commands listed at fastai’s quickstart page.

Later you can try %pip list | grep fastai and see what that says. (Most likely, if you examine the results from %pip list vs. !pip list, , or if you ran %pip list before doing what I suggested, there’d be some difference.).
You should read more about things here and substitute ‘fastai’ in place of ‘selenium’.