Import fastai libraries on local machine

Im trying to install FastAi package in my local windows machine.I got an error message stating no package found.

from fastai.imports import *
from fastai.structured import *

Can some one tell me how to get access to fastai package ?

The symlinks that jeremy uses and work fine on macs and linux failed me too when I tried on windows. In theory it should be possible to create redirect-links in windows too, but in practice this ā€šhackā€˜ also works: Just copy the fastai (library!) folder into the directory from which you run your code. Python looks for modules in the current working directory before searching in other places. This is NOT a clean or recommended solution, but at least it might get you up and running. Beware of the ongoing changes (see other threads regarding git repo), because of the release of fastai v1 the folder you need to use (copy) is the fastai v0.7 version now located in repo fastai/old/fastai.

Thanks a lot Marc. To make sure im doing the right thing,can you please tell me the below process is correct.
if i run jupyter notebook from my desktop.it would have the default working directory as Desktop.I need to copy all the fastai library to my desktop and run the below statement. in my jupyter notebook

from fastai.imports import *
from fastai.structured import

is it correct?

Hi Saby, not 100% certain what you mean by running it from the desktop. It is important to understand that the directory ā€œjupyter notebookā€ is run from is the ā€œbaseā€ directory and that relative to this python will search, so into that base folder the fastai library folder would have to go. So in your example above that sounds right, but ā€œstarting from the desktopā€ could mean any number of things. To be sure you know where jupyter runs, open a cmd or better anaconda-shell/prompt, then cd in to the directory you want to use as base, activate your environment and then type jupyter notebook manually. Then you know exactly where you started it from and that in that base dir the fastai folder/module will be searched. Btw, this articel shows how to reacreate the symlinks on windows with a command called mklink in order not to copy stuff around:

sorry for the confusion and thanks for the details.
i created a folder for Fastai courses separately (which is receding in my desktop) from where i would start my jupyter notebook.So my current working directory would be my desktop. since i dont have access to git and conda environment (due to office restirctions), i dont know how to install or activate the fast ai environment.
i tried pip install fastai=0.7. it was unable to install it.
Is there any workaround to use fastai Packages.

Thanks in advance :slight_smile:

Just follow the instructions from Jeremy on this thread:

specifically, step 8:

Replace the linux symlink with a Windows one (note that this requires an admin command prompt if you donā€™t have a fully updated version of Windows 10):
cd courses\dl1
del fastai
mklink /d fastai ..\..\old\fastai
cd ..\..

Hi guys, I guess after completing the this course is not the end and I will definitely use the fastai library.

Iā€™m a windows user and the course uses v0.7 and moving forward itā€™s v1.0. Iā€™m sure sticking to v0.7 is not the solution. How do use v1.0 for my kaggling and for work?

Or should I use Google Colab to un-complicate matters.

1 Like

How I can install fastai in python and then activate in jupyter notebook

You can install fastai via Anaconda.
Once you are in Anaconda terminal, the installation command is as simple as

conda install -c fastai -c pytorch -c anaconda fastai gh anaconda

More info on the fastai github page.

To use in jupyter notebook you can just import them eg
from fastai.vision.all import *

This is an example from fastbook on using fastai to classify images of digits.

Highly recommended to start with this playlist from Jeremy