[Solved] Blocking a fix: Error with `nbdev_build_lib` when submitting PR

Would be great if someone could take a look at this, its blocking a fix for this bug with SortedDl that I introduced :see_no_evil:


Running nbdev_build_lib produces:

FileNotFoundError: [Errno 2] No such file or directory: '/home/morgan/fastai2/docs/_config.yml'

Tried it also with an install in a clean fastai2 conda environment, new nbdev install. Also tried it with an editable nbdev install, same error

Did recent nbdev or fastai2 updates break something?

Full stack trace

Traceback (most recent call last):
  File "/home/morgan/anaconda3/envs/fastai2_me/bin/nbdev_build_lib", line 8, in <module>
    sys.exit(nbdev_build_lib())
  File "/home/morgan/anaconda3/envs/fastai2_me/lib/python3.7/site-packages/fastscript/core.py", line 76, in _f
    func(**args.__dict__)
  File "/home/morgan/anaconda3/envs/fastai2_me/lib/python3.7/site-packages/nbdev/cli.py", line 138, in nbdev_build_lib
    write_tmpls()
  File "/home/morgan/anaconda3/envs/fastai2_me/lib/python3.7/site-packages/nbdev/export2html.py", line 500, in write_tmpls
    write_tmpl(config_tmpl, 'user lib_name title copyright description', cfg, cfg.doc_path/'_config.yml')
  File "/home/morgan/anaconda3/envs/fastai2_me/lib/python3.7/site-packages/nbdev/export2html.py", line 494, in write_tmpl
    dest.write_text(outp)
  File "/home/morgan/anaconda3/envs/fastai2_me/lib/python3.7/pathlib.py", line 1235, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors) as f:
  File "/home/morgan/anaconda3/envs/fastai2_me/lib/python3.7/pathlib.py", line 1203, in open
    opener=self._opener)
  File "/home/morgan/anaconda3/envs/fastai2_me/lib/python3.7/pathlib.py", line 1058, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/morgan/fastai2/docs/_config.yml'

More so the library changed. Jeremy moved the docs to their own repo you need to clone before doing build_lib

1 Like

Ah cool, thanks, does that have to be cloned within the fastai2 repo? Cloned it in the same repo as fastai2 but no joy.

Was this documented anywhere or does the ā€œSubmitting a PRā€¦ā€ wiki need to be updated?

Ah, just saw this: Fastai v2 chat

1 Like

It seems it does (as Iā€™m even unsure, I believe you need to sim-link it), Iā€™ll bring it to Jeremyā€™s attention on Discord today and hopefully we can get a demo recorded :slight_smile:

Edit: whelp that would do it! :wink:

Solved, Cloning fastai-docs into the same repo as fastai2 as mentioned here works for me now, must have mess up somewhere before

1 Like

Iā€™m getting this same issue today when running nbdev_build_lib when trying to submit a PR. I cloned fastai-docs into the same repo as fastai and this is the error I am getting:

Traceback (most recent call last):
  File "C:\Users\avird\Anaconda3\envs\fastai_2020\Scripts\nbdev_build_lib-script.py", line 11, in <module>
    load_entry_point('nbdev', 'console_scripts', 'nbdev_build_lib')()
  File "C:\Users\avird\Anaconda3\envs\fastai_2020\lib\site-packages\fastscript\core.py", line 76, in _f
    func(**args.__dict__)
  File "c:\pillview\nih\nbdev\nbdev\cli.py", line 140, in nbdev_build_lib
    write_tmpls()
  File "c:\pillview\nih\nbdev\nbdev\export2html.py", line 505, in write_tmpls
    write_tmpl(config_tmpl, 'user lib_name title copyright description', cfg, cfg.doc_path/'_config.yml')
  File "c:\pillview\nih\nbdev\nbdev\export2html.py", line 499, in write_tmpl
    dest.write_text(outp)
  File "C:\Users\avird\Anaconda3\envs\fastai_2020\lib\pathlib.py", line 1235, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors) as f:
  File "C:\Users\avird\Anaconda3\envs\fastai_2020\lib\pathlib.py", line 1203, in open
    opener=self._opener)
  File "C:\Users\avird\Anaconda3\envs\fastai_2020\lib\pathlib.py", line 1058, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\PillView\\NIH\\fastai\\docs\\_config.yml'

I notice that the fastai repo does now have a docs folder anymore just docs_src

Current setup:

Any thoughts on how to fix?

Working on trying to figure out how to fix this as well, at first I thought we had to simply clone fastai-docs to the parent directory (whatever is above your fastai repo), but that seems not to work and the documentation for contributing mentions none of thisā€¦

1 Like

A solution would be great! If I remember correctly I did not look into it further, I also thought the same as you that it would simply involve cloning fastai-docs into the same directory that has fastai but it did not work, maybe Morgan can chime in as to how he was able to solve it.

Jeremy discussed it on the discord:

  1. Make sure your nbdev is the latest version
  2. You donā€™t need to clone the docs, GitHub will take care of that
  3. Use nbdev_build_lib not make fastai

(Havenā€™t tested this yet but i will tonight)

Please post back after you give it a try thanks!