Nbdev_diff_nbs - FileNotFoundError: [Errno 2] No such file or directory

I’m not able to update the docs files of my timeseries package. The build stops at the step Check if there is no diff library/notebooks. I included, here below, error traces from both my local machine and Github.

Error Trace when I run nbdev_diff_nbs on my local machine

when I run nbdev_diff_nbs on my local machine (full trace here below), first it issues This cell doesn't have an export destination and was ignored: message. It ends by FileNotFoundError: [Errno 2] No such file or directory: '/home/farid/fastai2/timeseries-2/timeseries/None.py' message. I don’t have any None.py file in the package.

How can I trace in which notebook the cell referenced in the message is located?

$ nbdev_diff_nbs
This cell doesn't have an export destination and was ignored:

Traceback (most recent call last):
  File "/home/farid/anaconda3/envs/fastai2_dev/bin/nbdev_diff_nbs", line 11, in <module>
    load_entry_point('nbdev', 'console_scripts', 'nbdev_diff_nbs')()
  File "/home/farid/anaconda3/envs/fastai2_dev/lib/python3.6/site-packages/fastscript/core.py", line 73, in _f
    func(**args.__dict__)
  File "/home/farid/fastai2/nbdev/nbdev/cli.py", line 33, in nbdev_diff_nbs
    diff_nb_script()
  File "/home/farid/fastai2/nbdev/nbdev/sync.py", line 138, in diff_nb_script
    notebook2script(silent=True)
  File "/home/farid/fastai2/nbdev/nbdev/export.py", line 372, in notebook2script
    for f in sorted(files): d = _notebook2script(f, silent=silent, to_dict=d)
  File "/home/farid/fastai2/nbdev/nbdev/export.py", line 311, in _notebook2script
    if to_dict is None: _add2all(fname_out, [f"'{f}'" for f in names if '.' not in f and len(f) > 0] + extra)
  File "/home/farid/fastai2/nbdev/nbdev/export.py", line 197, in _add2all
    with open(fname, 'r', encoding='utf8') as f: text = f.read()
FileNotFoundError: [Errno 2] No such file or directory: '/home/farid/fastai2/timeseries-2/timeseries/None.py'

Error Trace on GitHub

 Check if there is no diff library/notebooks1s
##[error]Process completed with exit code 1.
Run if [ -n "$(nbdev_diff_nbs)" ]; then echo -e "!!! Detected difference between the notebooks and the library"; false; fi
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.6.10/x64/bin/nbdev_diff_nbs", line 8, in <module>
    sys.exit(nbdev_diff_nbs())
  File "/opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/fastscript/core.py", line 73, in _f
    func(**args.__dict__)
  File "/opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nbdev/cli.py", line 33, in nbdev_diff_nbs
    diff_nb_script()
  File "/opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nbdev/sync.py", line 138, in diff_nb_script
    notebook2script(silent=True)
  File "/opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nbdev/export.py", line 372, in notebook2script
    for f in sorted(files): d = _notebook2script(f, silent=silent, to_dict=d)
  File "/opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nbdev/export.py", line 311, in _notebook2script
    if to_dict is None: _add2all(fname_out, [f"'{f}'" for f in names if '.' not in f and len(f) > 0] + extra)
  File "/opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages/nbdev/export.py", line 197, in _add2all
    with open(fname, 'r', encoding='utf8') as f: text = f.read()
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/timeseries/timeseries/timeseries/None.py'
!!! Detected difference between the notebooks and the library
##[error]Process completed with exit code 1.
``

I’m trying to contribute to fastai2, but nbdev_diff_nbs throws me the same error. Did you solve it?

Make sure you have all your export tags where they should be in your notebook. Including the exp tag for how to export it

I didn’t even do anything, I just cloned the fastai2 repo and ran nbdev_diff_nbs and faced this error.

@farid @vijayabhaskar not sure if you ever found the solution, but the issue is in some notebook you have a

#export
myfunc

being done without having a #default_exp module at the top

2 Likes

Ok if that’s the source of the problem is there any workarounds or a way to fix it? This is a windows specific error and this prevents windows users from contributing to the library. Fixing this would be nice, even though I know fastai doesn’t officially supports windows.

I haven’t tried it on windows, this popped up for me yesterday. Though if you do use windows I’d personally recommend WSL2 if you can, so you’re not bound by windows when trying to do stuff such as this

1 Like

I will soon move to WSL2. I was waiting for it to seamlessly support CUDA. Looks like it does now.

1 Like