Can't run fastai packages on Jupyter

Hello guys,

I hope this question is not redundant, but I couldn’t find a solution on the internet so far. I’ve followed the github guide (https://github.com/fastai/fastai) to install the fastai library on my Anaconda environment. I want to use this library to tackle the ML course and solve other Kaggle competitions with it.

As per below, I’m opening my conda environment, selecting fastai and opening Jupyter Notebook:

When trying to run the packages in Jupyter, I still get an Import Error with No module named ‘fastai’. Any suggestions on what I’m doing wrong?

How about handling this on the level of the Jupyter notebook?
Copy the fastai library (just the fastai subdirectory and all its contents) to a path accessible to the notebook.
You can place a symbolic link on it or use a suitable name.
In the first cell you could set a path and a few environment variables, like so:

import sys, os
sys.path.append('/my_library_path')
print(sys.path)
os.environ["TORCH_HOME"] = "/my_library_path/.torch"
os.environ["TORCH_MODEL_ZOO"] = "/my_library_path/pretrnd_mdls_pytorch/"

The last two are optional, just so you collect the pretrained models in one place. If you don’t set those, they’ll be in your home directory.

1 Like

Hi @OverFlow10,
I would recommend you to try using terminal instead.

Go to your terminal, then activate fastai environment with

source activate fastai

Then go to your desired folder using cd, for example

cd /User/my_project_folder

Then, activate jupyter notebook in there

jupyter notebook

The jupyter notebook should have used the fastai library in your desired folder location then.
I hope it helps. Thanks.