Very strange for me. I created a new conda environment and ran this from a jupyter cell and docs works. It looked like it was installing fastai to my main python install.
but I can’t get docs to work in my other environments. regardless of where i run that command…
@jeremy
It seems the specific way of creating the virtual environment has an affect if doc works or not.
Note the only difference is the anaconda included in the first “conda create” command
This works:
conda create -n doc_test5 python=3.6 anaconda
conda activate doc_test5
conda install -c pytorch -c fastai fastai
(doc_test5) ubuntu@ip-172-31-29-142:~$ python
Python 3.6.8 |Anaconda custom (64-bit)| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from fastai.vision import *
>>> doc()
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
TypeError: doc() missing 1 required positional argument: ‘elt’
This does not work:
conda create -n doc_test6 python=3.6
conda activate doc_test6
conda install -c pytorch -c fastai fastai
(doc_test6) ubuntu@ip-172-31-29-142:~$ python
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from fastai.vision import *
>>> doc()
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
NameError: name ‘doc’ is not defined
I looked through some fast.ai documentation and it does not specify to use the anaconda in the conda create command.
The difference between: conda create -n myenv python=x.x and conda create -n myenv python=x.x anaconda
The first installs bare minimum set up with no additional packages
The second installs anaconda packages
So possibly a missing anaconda package or missing config path in environment?
A failed experiment:
Hypothesis we are missing a package:-
I note in a fresh bare minimum environment running “conda install anaconda” will install all the anaconda packages.
Running “conda install anaconda” in a fastai conda environment results in only a single anaconda package being installed. However this new updated environment also fails with the same NameError: name ‘doc’ is not defined when used in Jupyter.
I have the missing doc problem and when I import it directly.
from fastai.gen_doc.nbdoc import doc
I was missing nbformat and nbconvert after the clean conda install.
-Ric
I came across the same issue: NameError: name 'doc' is not defined in lesson 1. When debugging CUDA memory errors deeper in lesson 1.
Since when running all cells above this point the issue goes away, it must be a missing library problem. After some fishing for what is missingfastbook lib seems to be it.
This one line solves the error for me: from fastbook import *
#two errors solved:
# -- NameError: name 'doc' is not defined
# -- NameError: name 'fine_tune' is not defined
from fastbook import *
#doc(Learner)
doc(Learner.fine_tune)
doc(Learner.fit_one_cycle)