Doc function was working fine yesterday, won't anymore on Colab

Hi, I’m just about done with Lesson 2 on Colab when all of a sudden the doc function isn’t working anymore in any of my notebooks in Google Drive. It was working flawlessly yesterday and now it just gives this error no matter what notebook I’m in. I tried Lesson 1 again and it is also giving the same error:

 TypeError Traceback (most recent call last)

[<ipython-input-3-6a10bdc817dc>](https://localhost:8080/#) in <module>() ----> 1 doc(cnn_learner)

2 frames

[/usr/local/lib/python3.6/dist-packages/fastai/gen_doc/nbtest.py](https://localhost:8080/#) in get_pytest_html(elt, anchor_id) 55 def get_pytest_html(elt, anchor_id:str)->Tuple[str,str]: 56 md = build_tests_markdown(elt) ---> 57 html = HTMLExporter().markdown2html(md).replace('\n','') # nbconverter fails to parse markdown if it has both html and '\n' 58 anchor_id = anchor_id.replace('.', '-') + '-pytest' 59 link, body = get_pytest_card(html, anchor_id)

TypeError: markdown2html() missing 1 required positional argument: 'source'

Appreciate any input on how to get it working again, really loving this course. The help function is still working fine but I enjoyed being able to link quickly to the relevant doc.

6 Likes

Same problem here, but on my local machine.

I have the same issue with Google Colab and when running on my local Windows 10 development machine (following Setup notes for fastai v1 on Windows 10). The issue does not exist when I run on Google Cloud (following Google Cloud Server Setup).

In case it helps someone identify the cause I have shared my configurations and the error messages below. I ran the following code on each platform:

from fastai import *
from fastai.vision import *
doc(ImageDataBunch)

1 Local Windows 10 Environment

1.1 Setup

=== Software === 
python        : 3.7.3
fastai        : 1.0.52
fastprogress  : 0.1.21
torch         : 1.1.0
torch cuda    : 10.0 / is available
torch cudnn   : 7401 / is enabled

=== Hardware === 
torch devices : 1
  - gpu0      : GeForce GTX 1050

=== Environment === 
platform      : Windows-10-10.0.17134-SP0
conda env     : fastai
python        : C:\Users\simon\.conda\envs\fastai\python.exe
sys.path      : C:\WINDOWS\system32
C:\Users\simon\.conda\envs\fastai\python37.zip
C:\Users\simon\.conda\envs\fastai\DLLs
C:\Users\simon\.conda\envs\fastai\lib
C:\Users\simon\.conda\envs\fastai
C:\Users\simon\.conda\envs\fastai\lib\site-packages
C:\Users\simon\.conda\envs\fastai\lib\site-packages\IPython\extensions
no nvidia-smi is found

1.2 Result

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-1ca7fede151e> in <module>
----> 1 doc(ImageDataBunch)

~\.conda\envs\fastai\lib\site-packages\fastai\gen_doc\nbdoc.py in doc(elt)
    129     use_relative_links = False
    130     elt = getattr(elt, '__func__', elt)
--> 131     md = show_doc(elt, markdown=False)
    132     if is_fastai_class(elt):
    133         md += f'\n\n<a href="{get_fn_link(elt)}" target="_blank" rel="noreferrer noopener">Show in docs</a>'

~\.conda\envs\fastai\lib\site-packages\fastai\gen_doc\nbdoc.py in show_doc(elt, doc_string, full_name, arg_comments, title_level, alt_doc_string, ignore_warn, markdown, show_tests)
    114     else: raise Exception(f'doc definition not supported for {full_name}')
    115     source_link = get_function_source(elt) if is_fastai_class(elt) else ""
--> 116     test_link, test_modal = get_pytest_html(elt, anchor_id=anchor_id) if show_tests else ('', '')
    117     title_level = ifnone(title_level, 2 if inspect.isclass(elt) else 4)
    118     doc =  f'<h{title_level} id="{anchor_id}" class="doc_header">{name}{source_link}{test_link}</h{title_level}>'

~\.conda\envs\fastai\lib\site-packages\fastai\gen_doc\nbtest.py in get_pytest_html(elt, anchor_id)
     55 def get_pytest_html(elt, anchor_id:str)->Tuple[str,str]:
     56     md = build_tests_markdown(elt)
---> 57     html = HTMLExporter().markdown2html(md).replace('\n','') # nbconverter fails to parse markdown if it has both html and '\n'
     58     anchor_id = anchor_id.replace('.', '-') + '-pytest'
     59     link, body = get_pytest_card(html, anchor_id)

TypeError: markdown2html() missing 1 required positional argument: 'source'

2 Google Colab

2.1 Setup

=== Software === 
python        : 3.6.7
fastai        : 1.0.52
fastprogress  : 0.1.21
torch         : 1.0.1.post2
nvidia driver : 410.79
torch cuda    : 10.0.130 / is available
torch cudnn   : 7402 / is enabled

=== Hardware === 
nvidia gpus   : 1
torch devices : 1
  - gpu0      : 15079MB | Tesla T4

=== Environment === 
platform      : Linux-4.14.79+-x86_64-with-Ubuntu-18.04-bionic
distro        : #1 SMP Wed Dec 19 21:19:13 PST 2018
conda env     : Unknown
python        : /usr/bin/python3
sys.path      : 
/env/python
/usr/lib/python36.zip
/usr/lib/python3.6
/usr/lib/python3.6/lib-dynload
/usr/local/lib/python3.6/dist-packages
/usr/lib/python3/dist-packages
/usr/local/lib/python3.6/dist-packages/IPython/extensions

2.2 Result

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-1ca7fede151e> in <module>()
----> 1 doc(ImageDataBunch)

2 frames
/usr/local/lib/python3.6/dist-packages/fastai/gen_doc/nbdoc.py in doc(elt)
    129     use_relative_links = False
    130     elt = getattr(elt, '__func__', elt)
--> 131     md = show_doc(elt, markdown=False)
    132     if is_fastai_class(elt):
    133         md += f'\n\n<a href="{get_fn_link(elt)}" target="_blank" rel="noreferrer noopener">Show in docs</a>'

/usr/local/lib/python3.6/dist-packages/fastai/gen_doc/nbdoc.py in show_doc(elt, doc_string, full_name, arg_comments, title_level, alt_doc_string, ignore_warn, markdown, show_tests)
    114     else: raise Exception(f'doc definition not supported for {full_name}')
    115     source_link = get_function_source(elt) if is_fastai_class(elt) else ""
--> 116     test_link, test_modal = get_pytest_html(elt, anchor_id=anchor_id) if show_tests else ('', '')
    117     title_level = ifnone(title_level, 2 if inspect.isclass(elt) else 4)
    118     doc =  f'<h{title_level} id="{anchor_id}" class="doc_header">{name}{source_link}{test_link}</h{title_level}>'

/usr/local/lib/python3.6/dist-packages/fastai/gen_doc/nbtest.py in get_pytest_html(elt, anchor_id)
     55 def get_pytest_html(elt, anchor_id:str)->Tuple[str,str]:
     56     md = build_tests_markdown(elt)
---> 57     html = HTMLExporter().markdown2html(md).replace('\n','') # nbconverter fails to parse markdown if it has both html and '\n'
     58     anchor_id = anchor_id.replace('.', '-') + '-pytest'
     59     link, body = get_pytest_card(html, anchor_id)

TypeError: markdown2html() missing 1 required positional argument: 'source'

3 Google Cloud

3.1 Setup

=== Software === 
python        : 3.6.7
fastai        : 1.0.52
fastprogress  : 0.1.21
torch         : 1.0.1.post2
nvidia driver : 410.79
torch cuda    : 10.0.130 / is available
torch cudnn   : 7402 / is enabled

=== Hardware === 
nvidia gpus   : 1
torch devices : 1
  - gpu0      : 15079MB | Tesla T4

=== Environment === 
platform      : Linux-4.14.79+-x86_64-with-Ubuntu-18.04-bionic
distro        : #1 SMP Wed Dec 19 21:19:13 PST 2018
conda env     : Unknown
python        : /usr/bin/python3
sys.path      : 
/env/python
/usr/lib/python36.zip
/usr/lib/python3.6
/usr/lib/python3.6/lib-dynload
/usr/local/lib/python3.6/dist-packages
/usr/lib/python3/dist-packages
/usr/local/lib/python3.6/dist-packages/IPython/extensions

3.2 Result

The doc function worked fine.

I hope this helps. Let me know what other information would be valuable.

Simon

Same problem here on fresh Ubuntu install

I just started the class today and stumbled on the same issue.
It seems to be due to a breaking change in the nbconvert package in version 5.5 (which is used in fastai lib)
A quick workaround is to go back to version 5.4.1:

conda install nbconvert=5.4.1

The problematic function signature is (https://github.com/jupyter/nbconvert/blob/5.5/nbconvert/exporters/html.py):

markdown2html(self, context, source)

The old signature (version 5.4.1) is (https://github.com/jupyter/nbconvert/blob/5.4.1/nbconvert/exporters/html.py):

markdown2html(self, source):

The new release (5.5) is 10 days old. I guess this is why we are experiencing this now.

I have no clue on which project and where we should open an issue for this? Any idea?

7 Likes

I guess you can post an issue here https://github.com/fastai/fastai/issues

Looks like someone already reported it to the jupyter folks: https://github.com/jupyter/nbconvert/issues/1007

It was reported here and fixed by sgugger (already!) here. Not sure when the next release of fastai will be but you could install the development version.

2 Likes

Thanks. This fixed it for me.

Hi!

I’m very new to the coding and community, but very eager!) could you help me understand how to fix this issue? I don’t actually understand what to do with the fix that was made for thios problem, should i aplly it in the code at colab? or should i make a link to it in code. I appreciate your time, thank you!

2 Likes

Hi @Snap !

You can fix this issue by installing the bug fix version of fastai.

To do so, you just need to replace the following line in the bash script:

pip install fastai --upgrade > /dev/null

by this one:

pip install git+https://github.com/fastai/fastai.git

and save the file colab.bash and import it again in Colab then run the cell:

  !curl -s https://course.fast.ai/setup/colab | bash

Hope it helps !

1 Like

I applied the changes listed here:

now I get this

doc(interp.plot_top_losses)

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-19-a7fe6964f6f7> in <module>
----> 1 doc(interp.plot_top_losses)

NameError: name 'doc' is not defined

I am running a jupyter notebook in a conda environment specifically created for fastai with fastai installed as per instructions. ubuntu 18.04LTS

Seeing the same issue in the same version of ubuntu.

Chiheb - Thanks for taking the time, worked for me!

Hi Chiheb,

I am quite new here. Could you be a bit more specific? How can I change the content in the bash script?

Thanks in advance.

XZ

Hi @XZNLaiAI,

Please download the bash script by opening this link: https://course.fast.ai/setup/colab then follow the steps I detailed above.

Hope it helps !

1 Like

Thank you!

Problems solved! Thanks a lot!

Hi,
I just started lesson 1 and found the same problem. I am using google cloud and the ubuntu app using WSL as mentioned in the setup. How do I fix it?

How do I import the locally modified colab bash script into Colab?

Also, if I run the cell

!curl -s https://course.fast.ai/setup/colab | bash

then won’t I be running the original, un-modified script, and NOT my modified script? How will this help with this bug?

Thank you!

– Philip