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.

2 Likes

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

3 Likes

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+https://github.com/fastai/fastai_dev 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: https://github.com/fastai/nbdev

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

from fastai2.vision.core 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 https://github.com/fastai/nbdev && \
    pip install -e nbdev && \
    conda install -y -c fastai -c pytorch fastai && \
    mkdir /fastai2 && \
    cd /fastai2 && \
    git clone https://github.com/fastai/fastai_dev.git && \
    cd /fastai2/fastai_dev && \
    python setup.py 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 fastai2.vision.core import *

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

ModuleNotFoundError: No module named 'fastai2.data'

fastai2 is searching for the python fastai2.data module, which, I believe, used to be there in a former version.
Now, in version 2.0.1 of fastai2 there is no fastai2.data 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 fastai2.data 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 ReadMe.md, not the ones I gave above. Installing nbdev explicitely is not needed either.

import torch
from fastai2 import __version__
print(torch.__version__)
print(__version__)

1.3.1
0.0.4

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 https://github.com/fastai/fastscript
cd fastscript
pip install -e .[dev]
cd …
git clone https://github.com/fastai/nbdev
cd nbdev
pip install -e .[dev]
cd …
git clone https://github.com/fastai/fastcore
cd fastcore
pip install -e .[dev]
cd …
git clone https://github.com/fastai/fastai2
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 https://files.pythonhosted.org/packages/cf/78/7fd00b76ee3d35d76ee94ca35b53e432d97fe5654fe76ea67237a417fc53/fastcore-0.1.9-py3-none-any.whl
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.