Getting Started with fastai-v2

Your WSL kernel is trying to connect to a (probably nonexistent) X server to open Jupyter in the default web browser.

In my WSL .zshrc, I have jupyter notebook aliased as follows:

alias jupyter-nb=‘jupyter notebook --no-browser’

After you enter the command in your shell, you can open up Chrome or any other browser and direct it to localhost:8888.

This is much simpler than trying to setup an X server and have the window auto launch.


You can also set open_browser=False in your config file so you don’t have to change the command you run.


Thanks it’s resolved. :slight_smile:

@jeremy any list of TODOs one can pick up to contribute? Thanks!

1 Like

Question about getting started with fastai-v2 on Google Cloud here. I try to run Jeremy’s Kaggle example myself: From prototyping to submission (fastai).

After going through all the steps above, fastaiv2 seemed installed. See image for an example.

Still I got: ModuleNotFoundError: No module named 'fastai2'.

What could be wrong? Thanks.

Why is fastai_dev under course-v3?

It should be fine just to type pip install git+ in the command line.

I was able to run and submit using this kernel from GCP.

1 Like

Is it there a tutorial somewhere on how to use the development (how they work) tools for other projects?

Not yet now. I’ll package them separately once v2 is finished, in the meantime you can probably extract the relevant modules.

I saw you posted nbdev, do you have a basic getting started?
My bad, there is a readme now:

As of Dec 2019 fastai v2 has dependencies on nbdev. So, if you just installed fastai2 and go

from import *

you’ll get an error.

To resolve you might want to install both, nbdev and fastai2, e.g. as an editable install using:

pip install packaging && \
    git clone && \
    pip install -e nbdev && \
    conda install -y -c fastai -c pytorch fastai && \
    mkdir /fastai2 && \
    cd /fastai2 && \
    git clone && \
    cd /fastai2/fastai_dev && \
    python build && \
    pip install -e .

Sorry, I posted too early. The above didn’t quite do it for me. Now I am getting a different one:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-8-78a5dc88e87d> in <module>
----> 1 from import *

/fastai2/fastai_dev/fastai2/vision/ in <module>
      9 from ..test import *
     10 from ..torch_basics import *
---> 11 from import *
     13 from PIL import Image

ModuleNotFoundError: No module named ''

fastai2 is searching for the python module, which, I believe, used to be there in a former version.
Now, in version 2.0.1 of fastai2 there is no folder (I checked on the os level).
I haven’t quite figured it out yet and will post again when I have.
The docs and nbs btw still assume to be there. Where did the data directory go?

You should be working out of the fastai2 repo now, not fastai_dev

1 Like

Here’s the link to the fastai2 repo on Github (just to help others who get to this point). The readme file contains installation instructions…

but I have a question. For both fastai v1 and v2, the install instructions recommend using pip to get the development version of the code. However, I’m using conda and I really like having separate environments for things. The fastai_v1 development install instructions say:

We don’t recommend using this approach [using conda ‘develop’] because it doesn’t play well with conda’s normal installs (a normal conda package install will supersede the editable install at run time). Unlike pip, conda’s normal packages are oblivious of their editable versions and vice versa - so you end up with having both and only one working. Moreover, conda doesn’t support extra dependencies implemented by pip ( dev dependencies).

It seems that pip -e just puts an “egg” file with a bunch of links into your filepath. Is it possible to create a new conda environment for fastai2 once you have used pip to do a development install (pip install -e)?

1 Like

@VishnuSubramanian Am I correct that the github links in your original post should be updated to point to fastai2?

I’ve fixed the top post in a few places. It’s a wiki post so feel free to update it as needed.

1 Like

I can confirm that worked. The correct installation instructions are the latest ones from the, not the ones I gave above. Installing nbdev explicitely is not needed either.

import torch
from fastai2 import __version__


My office proxy works fine with conda/mamba and git, but doesn’t trust pip for some reason. I’ve set up the global and added trusted sites and every hot tip I could find on stackoverflow, but no joy. Gave up trying to fix pip a long time ago, and recent efforts to try again for fastai2 were not getting any further.

I was finally able to install fastai2 without proxy issues, but it took multiple steps. Documenting here for anyone else finding themselves in this curious boat.

git clone
cd fastscript
pip install -e .[dev]
cd …
git clone
cd nbdev
pip install -e .[dev]
cd …
git clone
cd fastcore
pip install -e .[dev]
cd …
git clone
cd fastai2
pip install -e .[dev]
Successfully installed fastai2 Yay!

You can do:

cd fastai2
conda env create --file environment.yml -n NAME
conda activate NAME
pip install -e .[dev]

where NAME is the name you have chosen for the environment.

@jeremy, @sgugger , sorry to bother but …

Today, I totally reinstalled anaconda (on windows) and updated all libs. After that I installed conda version of pytorch 1.3.1 and I check its there working… When I try to install fastai2 as given below I get error…
PS: I do have only root env.

D:\codes\fastai_dev\fastai2>pip install --force-reinstall -e .[dev]
Obtaining file:///D:/codes/fastai_dev/fastai2
Collecting fastcore
Using cached
ERROR: Could not find a version that satisfies the requirement torch>=1.2.0 (from fastai2==0.0.4) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch>=1.2.0 (from fastai2==0.0.4)

Great, thanks.