Running course notebooks locally (01_intro.ipynb)


Being frustrated by Voila not working on Google Colab (I’m not able to proceed with the instructions related to app deployment via Voila/Binder, as given in Lesson 2), I’m trying to run course notebooks on my machine (mac).
After installing Anaconda, as well as Fastai (by using conda install -c fastai -c pytorch -c anaconda fastai gh anaconda) and trying to run the very first cell with fastbook setup I’m getting the following cryptic message(s): “AttributeError: ‘str’ object has no attribute ‘stored_args’”

I’m attaching the screenshot.
Asking Fastai community for help :slight_smile:


Perhaps check that you’ve installed fastbook in Anaconda directly (using $ conda list in Bash)? If not, perhaps try $ conda install fastbook -c fastai?

Thanks for that. Tried that (conda list shows “fastbook version 0.0.9”), still the same problem. Basically, if I am to run the course notebooks locally what is that that needs to be done/installed?
What I’ve done is downloaded the courses notebooks (via Download zip from fastai’s Github, run the pip install requirements.txt, now trying to run a course notebook in Anaconda. Still getting the same Attribute Error when running the very first cell (import fastbook).

Hmmm… Afraid I’m not sure then. If it’s any help, here’s the result of my $ conda list with a working local environment (on an Ubuntu 20.04 system).

# Name                    Version                   Build  Channel
_anaconda_depends         2020.07                  py38_0    anaconda
_libgcc_mutex             0.1                        main  
adal                      1.2.4                    pypi_0    pypi
alabaster                 0.7.12                     py_0    anaconda
anaconda                  custom                   py38_1    anaconda
anaconda-client           1.7.2                    py38_0    anaconda
anaconda-project          0.8.4                      py_0    anaconda
argh                      0.26.2                   py38_0    anaconda
argon2-cffi               20.1.0           py38h7b6447c_1    anaconda
asn1crypto                1.4.0                      py_0    anaconda
astroid                   2.4.2                    py38_0    anaconda
astropy                   4.0.1.post1      py38h7b6447c_1    anaconda
async-generator           1.10                     pypi_0    pypi
atomicwrites              1.4.0                      py_0    anaconda
attrs                     19.3.0                     py_0    anaconda
autopep8                  1.5.4                      py_0    anaconda
azure-cognitiveservices-search-imagesearch 2.0.0                    pypi_0    pypi
azure-common              1.1.25                   pypi_0    pypi
babel                     2.8.0                      py_0    anaconda
backcall                  0.2.0                      py_0    anaconda
backports                 1.0                        py_2    anaconda
backports.shutil_get_terminal_size 1.0.0                    py38_2    anaconda
beautifulsoup4            4.9.1                    py38_0    anaconda
bitarray                  1.5.2            py38h7b6447c_0    anaconda
bkcharts                  0.2                      py38_0    anaconda
blas                      1.0                         mkl    anaconda
bleach                    3.1.5                      py_0    anaconda
blosc                     1.19.0               hd408876_0    anaconda
bokeh                     2.1.1                    py38_0    anaconda
boto                      2.49.0                   py38_0    anaconda
bottleneck                1.3.2            py38heb32a55_1    anaconda
brotlipy                  0.7.0           py38h7b6447c_1000    anaconda
bzip2                     1.0.8                h7b6447c_0    anaconda
ca-certificates           2020.7.22                     0    anaconda
cairo                     1.14.12              h8948797_3    anaconda
catalogue                 1.0.0                    py38_1    anaconda
certifi                   2020.6.20                py38_0    anaconda
cffi                      1.14.1           py38he30daa8_0    anaconda
chardet                   3.0.4                 py38_1003    anaconda
click                     7.1.2                      py_0    anaconda
cloudpickle               1.5.0                      py_0    anaconda
clyent                    1.2.2                    py38_1    anaconda
colorama                  0.4.3                      py_0    anaconda
contextlib2               0.6.0.post1                py_0    anaconda
cryptography              2.9.2            py38h1ba5d50_0    anaconda
cudatoolkit               10.2.89              hfd86e86_1    anaconda
curl                      7.71.1               hbc83047_1    anaconda
cycler                    0.10.0                   py38_0    anaconda
cymem                     2.0.3            py38he6710b0_0    anaconda
cython                    0.29.21          py38he6710b0_0    anaconda
cython-blis               0.4.1            py38h7b6447c_1    anaconda
cytoolz                   0.10.1           py38h7b6447c_0    anaconda
dask                      2.20.0                     py_0    anaconda
dask-core                 2.20.0                     py_0    anaconda
dataclasses               0.6                      pypi_0    pypi
dbus                      1.13.12              h746ee38_0    anaconda
decorator                 4.4.2                      py_0    anaconda
defusedxml                0.6.0                      py_0    anaconda
diff-match-patch          20200713                   py_0    anaconda
distributed               2.20.0                   py38_0    anaconda
docutils                  0.16                     py38_1    anaconda
entrypoints               0.3                      py38_0    anaconda
et_xmlfile                1.0.1                   py_1001    anaconda
expat                     2.2.9                he6710b0_2    anaconda
fastai                    2.0.0              pyh39e3cac_0    fastai
fastbook                  0.0.9                    pypi_0    pypi
fastcache                 1.1.0            py38h7b6447c_0    anaconda
fastcore                  1.0.0              pyh39e3cac_0    fastai
fastprogress              1.0.0              pyh39e3cac_0    fastai
fastscript                1.0.0              pyh39e3cac_0    fastai
filelock                  3.0.12                     py_0    anaconda
flake8                    3.8.3                      py_0    anaconda
flask                     1.1.2                      py_0    anaconda
fontconfig                2.13.0               h9420a91_0    anaconda
freetype                  2.10.2               h5ab3b9f_0    anaconda
fribidi                   1.0.10               h7b6447c_0    anaconda
fsspec                    0.8.0                      py_0    anaconda
future                    0.18.2                   py38_1    anaconda
get_terminal_size         1.0.0                haa9412d_0    anaconda
gevent                    20.6.2           py38h7b6447c_0    anaconda
gh                        0.11.1                        0    fastai
glib                      2.56.2               hd408876_0    anaconda
glob2                     0.7                        py_0    anaconda
gmp                       6.1.2                hb3b607b_0    anaconda
gmpy2                     2.0.8            py38hd5f6e3b_3    anaconda
graphite2                 1.3.14               h23475e2_0    anaconda
graphviz                  2.40.1               h21bd128_2    anaconda
greenlet                  0.4.16           py38h7b6447c_0    anaconda
gst-plugins-base          1.14.0               hbbd80ab_1    anaconda
gstreamer                 1.14.0               hb453b48_1    anaconda
h5py                      2.10.0           py38h7918eee_0    anaconda
harfbuzz                  1.8.8                hffaf4a1_0    anaconda
hdf5                      1.10.4               hb1b8bf9_0    anaconda
heapdict                  1.0.1                      py_0    anaconda
html5lib                  1.1                        py_0    anaconda
icu                       58.2                 he6710b0_3    anaconda
idna                      2.10                       py_0    anaconda
imageio                   2.9.0                      py_0    anaconda
imagesize                 1.2.0                      py_0    anaconda
importlib-metadata        1.7.0                    py38_0    anaconda
importlib_metadata        1.7.0                         0    anaconda
iniconfig                 1.0.1                      py_0    anaconda
intel-openmp              2020.1                      217    anaconda
intervaltree              3.0.2                      py_1    anaconda
ipykernel                 5.3.4            py38h5ca1d4c_0    anaconda
ipython                   7.16.1           py38h5ca1d4c_0    anaconda
ipython_genutils          0.2.0                    py38_0    anaconda
ipywidgets                7.5.1                      py_0    anaconda
isodate                   0.6.0                    pypi_0    pypi
isort                     4.3.21                   py38_0    anaconda
itsdangerous              1.1.0                      py_0    anaconda
jbig                      2.1                  hdba287a_0    anaconda
jdcal                     1.4.1                      py_0    anaconda
jedi                      0.17.1                   py38_0    anaconda
jeepney                   0.4.3                      py_0    anaconda
jinja2                    2.11.2                     py_0    anaconda
joblib                    0.16.0                     py_0    anaconda
jpeg                      9b                   habf39ab_1    anaconda
json5                     0.9.5                      py_0    anaconda
jsonschema                3.0.2                    py38_0    anaconda
jupyter                   1.0.0                    py38_7    anaconda
jupyter-server            0.1.1                    pypi_0    pypi
jupyter_client            6.1.6                      py_0    anaconda
jupyter_console           6.1.0                      py_0    anaconda
jupyter_core              4.6.3                    py38_0    anaconda
jupyterlab                2.1.5                      py_0    anaconda
jupyterlab-pygments       0.1.1                    pypi_0    pypi
jupyterlab_server         1.2.0                      py_0    anaconda
keyring                   21.2.1                   py38_0    anaconda
kiwisolver                1.2.0            py38hfd86e86_0    anaconda
krb5                      1.18.2               h173b8e3_0    anaconda
lazy-object-proxy         1.4.3            py38h7b6447c_0    anaconda
lcms2                     2.11                 h396b838_0    anaconda
ld_impl_linux-64          2.33.1               h53a641e_7  
libarchive                3.4.2                h62408e4_0    anaconda
libcurl                   7.71.1               h20c2e04_1    anaconda
libedit                   3.1.20191231         h14c3975_1  
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.3.0                hdf63c60_0    anaconda
liblief                   0.10.1               he6710b0_0    anaconda
libllvm9                  9.0.1                h4a3c616_1    anaconda
libpng                    1.6.37               hbc83047_0    anaconda
libsodium                 1.0.18               h7b6447c_0    anaconda
libspatialindex           1.9.3                he6710b0_0    anaconda
libssh2                   1.9.0                h1ba5d50_1    anaconda
libstdcxx-ng              9.1.0                hdf63c60_0  
libtiff                   4.1.0                h2733197_1    anaconda
libtool                   2.4.6                h7b6447c_5    anaconda
libuuid                   1.0.3                h1bed415_2    anaconda
libxcb                    1.14                 h7b6447c_0    anaconda
libxml2                   2.9.10               he19cac6_1    anaconda
libxslt                   1.1.34               hc22bd24_0    anaconda
llvmlite                  0.33.0           py38hc6ec683_1    anaconda
locket                    0.2.0                    py38_1    anaconda
lxml                      4.5.2            py38hefd8a0e_0    anaconda
lz4-c                     1.9.2                he6710b0_1    anaconda
lzo                       2.10                 h7b6447c_2    anaconda
markupsafe                1.1.1            py38h7b6447c_0    anaconda
matplotlib                3.3.1                         0    anaconda
matplotlib-base           3.3.1            py38h817c723_0    anaconda
mccabe                    0.6.1                    py38_1    anaconda
mistune                   0.8.4           py38h7b6447c_1000    anaconda
mkl                       2019.4                      243    anaconda
mkl-service               2.3.0            py38he904b0f_0    anaconda
mkl_fft                   1.1.0            py38h23d657b_0    anaconda
mkl_random                1.1.0            py38h962f231_0    anaconda
mock                      4.0.2                      py_0    anaconda
more-itertools            8.4.0                      py_0    anaconda
mpc                       1.1.0                h10f8cd9_1    anaconda
mpfr                      4.0.2                hb69a4c5_1    anaconda
mpmath                    1.1.0                    py38_0    anaconda
msgpack-python            1.0.0            py38hfd86e86_1    anaconda
msrest                    0.6.18                   pypi_0    pypi
msrestazure               0.6.4                    pypi_0    pypi
multipledispatch          0.6.0                    py38_0    anaconda
murmurhash                1.0.2            py38he6710b0_0    anaconda
nbconvert                 5.6.1                    py38_0    anaconda
nbdev                     1.0.4                    pypi_0    pypi
nbformat                  5.0.7                      py_0    anaconda
ncurses                   6.2                  he6710b0_1  
networkx                  2.4                        py_1    anaconda
ninja                     1.10.0           py38hfd86e86_0    anaconda
nltk                      3.5                        py_0    anaconda
nose                      1.3.7                    py38_2    anaconda
notebook                  6.1.1                    py38_0    anaconda
numba                     0.50.1           py38h0573a6f_1    anaconda
numexpr                   2.7.1            py38h423224d_0    anaconda
numpy                     1.19.1           py38hbc911f0_0    anaconda
numpy-base                1.19.1           py38hfa32c7d_0    anaconda
numpydoc                  1.1.0                      py_0    anaconda
oauthlib                  3.1.0                    pypi_0    pypi
olefile                   0.46                       py_0    anaconda
openpyxl                  3.0.4                      py_0    anaconda
openssl                   1.1.1g               h7b6447c_0    anaconda
packaging                 20.4                       py_0    anaconda
pandas                    1.1.0            py38he6710b0_0    anaconda
pandoc                    2.10.1                        0    anaconda
pandocfilters             1.4.2                    py38_1    anaconda
pango                     1.42.4               h049681c_0    anaconda
parso                     0.7.0                      py_0    anaconda
partd                     1.1.0                      py_0    anaconda
patchelf                  0.11                 he6710b0_0    anaconda
path                      14.0.1                   py38_0    anaconda                   12.5.0                        0    anaconda
pathlib2                  2.3.5                    py38_0    anaconda
pathtools                 0.1.2                      py_1    anaconda
patsy                     0.5.1                    py38_0    anaconda
pcre                      8.44                 he6710b0_0    anaconda
pep8                      1.7.1                    py38_0    anaconda
pexpect                   4.8.0                    py38_0    anaconda
pickleshare               0.7.5                 py38_1000    anaconda
pillow                    7.2.0            py38hb39fc2d_0    anaconda
pip                       20.2.2                   py38_0  
pixman                    0.40.0               h7b6447c_0    anaconda
pkginfo                           py38_0    anaconda
plac                      0.9.6                    py38_1    anaconda
pluggy                    0.13.1                   py38_0    anaconda
ply                       3.11                     py38_0    anaconda
preshed                   3.0.2            py38he6710b0_1    anaconda
prometheus_client         0.8.0                      py_0    anaconda
prompt-toolkit            3.0.5                      py_0    anaconda
prompt_toolkit            3.0.5                         0    anaconda
psutil                    5.7.0            py38h7b6447c_0    anaconda
ptyprocess                0.6.0                    py38_0    anaconda
py                        1.9.0                      py_0    anaconda
py-lief                   0.10.1           py38h403a769_0    anaconda
pycodestyle               2.6.0                      py_0    anaconda
pycosat                   0.6.3            py38h7b6447c_1    anaconda
pycparser                 2.20                       py_2    anaconda
pycurl                   py38h1ba5d50_0    anaconda
pydocstyle                5.0.2                      py_0    anaconda
pyflakes                  2.2.0                      py_0    anaconda
pygments                  2.6.1                      py_0    anaconda
pyjwt                     1.7.1                    pypi_0    pypi
pylint                    2.5.3                    py38_0    anaconda
pyodbc                    4.0.30           py38he6710b0_0    anaconda
pyopenssl                 19.1.0                     py_1    anaconda
pyparsing                 2.4.7                      py_0    anaconda
pyqt                      5.9.2            py38h05f1152_4    anaconda
pyrsistent                0.16.0           py38h7b6447c_0    anaconda
pysocks                   1.7.1                    py38_0    anaconda
pytables                  3.6.1            py38h9fd0a39_0    anaconda
pytest                    6.0.1                    py38_0    anaconda
python                    3.8.5                hcff3b4d_0  
python-dateutil           2.8.1                      py_0    anaconda
python-graphviz           0.14                       py_0  
python-jsonrpc-server     0.3.4                      py_1    anaconda
python-language-server    0.34.1                   py38_0    anaconda
python-libarchive-c       2.9                        py_0    anaconda
pytorch                   1.6.0           py3.8_cuda10.2.89_cudnn7.6.5_0    pytorch
pytz                      2020.1                     py_0    anaconda
pywavelets                1.1.1            py38h7b6447c_0    anaconda
pyxdg                     0.26                       py_0    anaconda
pyyaml                    5.3.1            py38h7b6447c_1    anaconda
pyzmq                     19.0.1           py38he6710b0_1    anaconda
qdarkstyle                2.8.1                      py_0    anaconda
qt                        5.9.7                h5867ecd_1    anaconda
qtawesome                 0.7.2                      py_0    anaconda
qtconsole                 4.7.5                      py_0    anaconda
qtpy                      1.9.0                      py_0    anaconda
readline                  8.0                  h7b6447c_0  
regex                     2020.7.14        py38h7b6447c_0    anaconda
requests                  2.24.0                     py_0    anaconda
requests-oauthlib         1.3.0                    pypi_0    pypi
ripgrep                   11.0.2               he32d670_0    anaconda
rope                      0.17.0                     py_0    anaconda
rtree                     0.9.4                    py38_1    anaconda
ruamel_yaml               0.15.87          py38h7b6447c_1    anaconda
scikit-image              0.16.2           py38h0573a6f_0    anaconda
scikit-learn              0.23.1           py38h423224d_0    anaconda
scipy                     1.5.2            py38h0b6359f_0    anaconda
seaborn                   0.10.1                     py_0    anaconda
secretstorage             3.1.2                    py38_0    anaconda
send2trash                1.5.0                    py38_0    anaconda
sentencepiece             0.1.86                   pypi_0    pypi
setuptools                49.6.0                   py38_0  
simplegeneric             0.8.1                    py38_2    anaconda
singledispatch                    py38_0    anaconda
sip                       4.19.24          py38he6710b0_0    anaconda
six                       1.15.0                     py_0    anaconda
snappy                    1.1.8                he6710b0_0    anaconda
snowballstemmer           2.0.0                      py_0    anaconda
sortedcollections         1.2.1                      py_0    anaconda
sortedcontainers          2.2.2                      py_0    anaconda
soupsieve                 2.0.1                      py_0    anaconda
spacy                     2.3.1            py38hfd86e86_0    anaconda
sphinx                    3.2.1                      py_0    anaconda
sphinxcontrib             1.0                      py38_1    anaconda
sphinxcontrib-applehelp   1.0.2                      py_0    anaconda
sphinxcontrib-devhelp     1.0.2                      py_0    anaconda
sphinxcontrib-htmlhelp    1.0.3                      py_0    anaconda
sphinxcontrib-jsmath      1.0.1                      py_0    anaconda
sphinxcontrib-qthelp      1.0.3                      py_0    anaconda
sphinxcontrib-serializinghtml 1.1.4                      py_0    anaconda
sphinxcontrib-websupport  1.2.4                      py_0    anaconda
spyder                    4.1.4                    py38_0    anaconda
spyder-kernels            1.9.2                    py38_0    anaconda
sqlalchemy                1.3.18           py38h7b6447c_0    anaconda
sqlite                    3.33.0               h62c20be_0  
srsly                     1.0.2            py38he6710b0_0    anaconda
statsmodels               0.11.1           py38h7b6447c_0    anaconda
sympy                     1.6.1                    py38_0    anaconda
tbb                       2020.1               hfd86e86_0    anaconda
tblib                     1.7.0                      py_0    anaconda
terminado                 0.8.3                    py38_0    anaconda
testpath                  0.4.4                      py_0    anaconda
thinc                     7.4.1            py38hfd86e86_0    anaconda
threadpoolctl             2.1.0              pyh5ca1d4c_0    anaconda
tk                        8.6.10               hbc83047_0  
toml                      0.10.1                     py_0    anaconda
toolz                     0.10.0                     py_0    anaconda
torchvision               0.7.0                py38_cu102    pytorch
tornado                   6.0.4            py38h7b6447c_1    anaconda
tqdm                      4.48.2                     py_0    anaconda
traitlets                 4.3.3                    py38_0    anaconda
typing_extensions                    py_0    anaconda
ujson                     1.35             py38h7b6447c_0    anaconda
unicodecsv                0.14.1                   py38_0    anaconda
unixodbc                  2.3.7                h14c3975_0    anaconda
urllib3                   1.25.10                    py_0    anaconda
voila                     0.1.22                   pypi_0    pypi
wasabi                    0.7.1                      py_0    anaconda
watchdog                  0.10.3                   py38_0    anaconda
wcwidth                   0.2.5                      py_0    anaconda
webencodings              0.5.1                    py38_1    anaconda
werkzeug                  1.0.1                      py_0    anaconda
wheel                     0.35.1                     py_0  
widgetsnbextension        3.5.1                    py38_0    anaconda
wrapt                     1.11.2           py38h7b6447c_0    anaconda
wurlitzer                 2.0.1                    py38_0    anaconda
xlrd                      1.2.0                      py_0    anaconda
xlsxwriter                1.2.9                      py_0    anaconda
xlwt                      1.3.0                    py38_0    anaconda
xz                        5.2.5                h7b6447c_0  
yaml                      0.2.5                h7b6447c_0    anaconda
yapf                      0.30.0                     py_0    anaconda
zeromq                    4.3.2                he6710b0_2    anaconda
zict                      2.0.0                      py_0    anaconda
zipp                      3.1.0                      py_0    anaconda
zlib                      1.2.11               h7b6447c_3  
zope                      1.0                      py38_1    anaconda
zope.event                4.4                      py38_0    anaconda
zope.interface            4.7.1            py38h7b6447c_0    anaconda
zstd                      1.4.4                h0b5b093_3    anaconda

This is the type of error I get when trying to import * from (see below).

Any help appreciated!

Yeah, this is exactly the error I have right now after just setting up a Windows installation and running the import cell at the top of lesson 1.

Fixed it by downloading the latest fastai source from github again, deleting my existing folder (which I had called “fastai2”, btw) and extracting the github .zip to “fastai-master” and then renaming that new folder to be just “fastai”. Started my kernel again, and all fixed now.

Note that I had followed the steps written in Deploy fastai-v2 model on windows machine in the meantime, gotten the “No module named ‘fastai2’” error mentioned on that page and then updated my fastai source, but I then went back and tried the environment and kernel I already had when I was getting the error on this page, and it’s still fixed, so I think the issue is simply using a version of fastai with a bug in…

Awesome. Managed to make it work by following the same steps (downloading the latest fastai source, etc.). Thanks!

I thought I would share how I got local setup working without a lot of a hassle.

I am assuming one has already cloned the repo and it is on the repo folder.

To get it working I have updated my environment.yml to the snippet below , (There is PR to get this merged).

name: fastai
- fastai
- pytorch
- defaults
- jupyter
- pytorch>=1.3.0
- torchvision>=0.5
- matplotlib
- pandas
- requests
- pyyaml
- fastprogress>=0.1.22
- pillow
- python>=3.6
- scikit-learn
- scipy
- spacy
- pip
- pip:
  - graphviz
  - fastbook

Now one can create an environment using :

conda env create --file environment.yml

To activate the environment:

conda activate fastai

And to run the jupyter notebooks:

jupyter notebook

Hope this helps out those that want to run this locally.
In case you have conflict because fastai environment already exists, you can give it a new name, or remove it. I recommend removing the older environment (if you can).

To replace and old fastai environment with the new suggest one follow these steps:

conda deactivate
conda env remove --name fastai
conda env create --file environment.yml
conda activate fastai