Can't import fastai to local Jupyter notebook

0

I am trying to run a notebook locally and so I want to import the following packages:

import pandas as pd

from fastai import *
from fastai.vision import *
from fastai.callbacks.hooks import *
from pathlib import Path
import os, git, glob, shutil

But it is throwing this error:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-10b32c200355> in <module>
      1 import pandas as pd
      2 
----> 3 from fastai import *
      4 from fastai.vision import *
      5 from fastai.callbacks.hooks import *

ModuleNotFoundError: No module named 'fastai'

This shouldn’t be the case because I already have fastai installed on my machine via pip. Is there a way to use my local libraries on a notebook that is also local?

Do you have both a native Python installation and anaconda side by side? Or do you have several conda environments? In the latter case https://github.com/Anaconda-Platform/nb_conda_kernels could be an interesting tool for you to keep track of your current environment.

I have no conda installed. I try to avoid it as best as I can. I just have the standalone jupyterlabs and notebook installed.

If a library is installed, then it is installed and Jupyter does not create any disturbances on that topic. Therefore, I guess that either the installation failed and you did not realize that or you installed it somewhere else, e.g. you have Python 2 and Python 3 side by side on your machine and happened to use the ‘wrong’ pip for Jupyter.

I do have both Python versions installed side by side. What pip do I use for Python 3? And why do I need to use pip again on Jupyter when the library is installed?

And it is 100% installed on my machine. I can use these libraries on Pycharm.

Then I bet you accidentally installed fastai for the wrong Pyrhon version. Please look deeply into how to use pip properly and send the command line logs in case you persist to have troubles.

I tried using pip3. I think I got it working. I will post updates. Thank you.