ModuleNotFoundError: No module named 'fastai'

(Aless Bandrabur) #4

What Python version do you use?

There should be a path issue, I guess. Never tried it on Windows.

(ecdrid) #5

The problem is wrong location of the notebook which you are running?

Put all your notebooks in either the ml.or the DL sub directory…

(Nilesh Garg) #6

I am opening file from ml folder. No changes in directory structure.

(Nilesh Garg) #7

sys.version_info(major=3, minor=6, micro=4, releaselevel=‘final’, serial=0)

(Nilesh Garg) #8

3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]


Follow step 8 here:

Note that you’ll need to do this every time you do a git pull! (I had everything working for lesson 1 then did a git pull before I started lesson 2 and couldn’t figure out why it wasn’t working until I went back to lesson 1 and realized it was no longer working either!)

(Nilesh Garg) #10

Thanks a lot, it worked. please help me with running shell commands from jupyter notebook (windows OS).

(ecdrid) #11

!dir {Path}

(Tiri) #12

I have the same problem as you had, No module named ‘fastai’. What did worked for you? you didn’t mention the solution.
I’m running on windows7 but for this step , it should not change something.
I run the file directly where it is located, and i have a path like this,
should i change the content of local fastai file located in the dl1 folder maybe?
any idea?

(Ajay Singh) #13

Hello Nilesh can you tell me what changes you made to make it work. As I am too facing the same problem in Windows 10.

(Nilesh Garg) #14

we need to create shortcut or windows link of fastai folder in current working folder and remove the existing fasai folder link.

(Ajay Singh) #15

Actually I followed the creation of link from both Windows way and as well as mklink way. Still for some reason if seems to not recognize the soft link.
In fact when I created soft link using mklink that Jermey had described, it did not even show me in the directory window.
When I created thru windows folder new link it shows the fastai as link folder.
But none of these options are working.

I had to add sys.path.append("…/…/…/fastai") to make it work but I hate to add extra code in the note book at least while I am starting out.

(Ryan Prosser) #16

Thanks for the help down the right path.
I managed to fix the import without adding a sys.path.append by modifying the prescribed windows installation steps from :

mklink /d fastai …\fastai
mklink /d fastai …\fastai\

it just wasn’t redirecting to the folder correctly.

I hope that helps someone else.

(Giancarlo) #17

Thanks, it worked for me on windows10 and Anaconda for the DL2 - 2018 course

(Sahil Kaushal) #18

I installed everything in ubuntu 18.04 but when i run the code it still give import error.

(Pierre Guillou) #19

Ubuntu does not support GPU on Windows.
You must follow this guide : Howto: installation on Windows

(Gerardo Garcia) #20

(Robert William Babaev) #21

Okay, I tried this running pretty much letter for letter until I got this in step 7: ‘jupyter’ is not recognized as an internal or external command, operable program or batch file.

Not sure how to fix that.


I had this error message whilst running the code from a JupyterLab notebook. Turns out I just had to manually add the “fastai” kernel to the virtual environment created for the course (fastai). This stack overflow answer worked for me:

After activating your fastai environment, simply run this command:
python -m ipykernel install --user --name myenv --display-name “Python (myenv)”

(Lars Holmberg) #23

I am using the standard Paperspace Notebook and everything works fine
When I restart the notebook I get the error in Jupyter:

from fastai.imports import *
ModuleNotFoundError: No module named 'fastai'

If I try to activate fastai from the terminal

source activate fastai 

I get

/bin/sh: 14: source: not found

I have read and tried many things so now I hope for a condensed answer.