fastai / nbdev_template

Template for nbdev projects
https://nbdev.fast.ai/
Apache License 2.0
293 stars 99 forks source link

Error message when calling `nbdev_build_lib` #31

Closed urspb closed 3 years ago

urspb commented 3 years ago

nbdev_build_lib produces the error messages stated below. When I tried commit Merge pull request #27 from muellerzr/master 99a3810 Jeremy Howard <j@fast.ai> 2021-01-10, 18:00 the error does not appear.

➜  nb2ltx git:(master) ✗ nbdev_build_lib
Traceback (most recent call last):
  File "/Users/uli/.pyenv/versions/nbdevTst1/bin/nbdev_build_lib", line 8, in <module>
    sys.exit(nbdev_build_lib())
  File "/Users/uli/.pyenv/versions/3.7.9/envs/nbdevTst1/lib/python3.7/site-packages/fastcore/script.py", line 105, in _f
    tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/Users/uli/.pyenv/versions/3.7.9/envs/nbdevTst1/lib/python3.7/site-packages/nbdev/export2html.py", line 477, in nbdev_build_lib
    write_tmpls()
  File "/Users/uli/.pyenv/versions/3.7.9/envs/nbdevTst1/lib/python3.7/site-packages/nbdev/export2html.py", line 470, in write_tmpls
    write_tmpl(topnav_tmpl, 'host git_url', cfg, path/'_data'/'topnav.yml')
  File "/Users/uli/.pyenv/versions/3.7.9/envs/nbdevTst1/lib/python3.7/site-packages/nbdev/export2html.py", line 462, in write_tmpl
    dest.write_text(outp)
  File "/Users/uli/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py", line 1240, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors) as f:
  File "/Users/uli/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py", line 1208, in open
    opener=self._opener)
  File "/Users/uli/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py", line 1063, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/uli/Develop/GitHub/nb2ltx/docs/_data/topnav.yml'
urspb commented 3 years ago

With commit 16a5ed81f8b29303322656cc191f74b6cf401fff a lot of files in docs directory were deleted. This seems to the reason for the error I got.

lucharo commented 3 years ago

I got the same error on nbdev 1.1.11 with the nbdev template forked today

hamelsmu commented 3 years ago

Try again, we just made a new release

lucharo commented 3 years ago

Will try it tonight! Thanks @hamelsmu

urspb commented 3 years ago

Try again, we just made a new release

Unfortunately it's still not working. As I mentioned in https://github.com/fastai/nbdev_template/issues/31#issuecomment-761765166 , a lot of files in ./docs have been removed. The error message I got states that at least the file ./docs/_data/topnav.yml is missing.

➜  nb3ltx git:(master) ✗ nbdev_build_lib
Traceback (most recent call last):
  File "/Users/uli/.pyenv/versions/nb2ltx/bin/nbdev_build_lib", line 8, in <module>
    sys.exit(nbdev_build_lib())

...

  File "/Users/uli/.pyenv/versions/3.7.9/envs/nb2ltx/lib/python3.7/site-packages/nbdev/export2html.py", line 467, in write_tmpl
    dest.write_text(outp)
  File "/Users/uli/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py", line 1240, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors) as f:
  File "/Users/uli/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py", line 1208, in open
    opener=self._opener)
  File "/Users/uli/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py", line 1063, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/uli/Develop/GitHub/nb3ltx/docs/_data/topnav.yml'
➜  nb3ltx git:(master) ✗
hamelsmu commented 3 years ago

./docs have been removed. Yup. That is on purpose.

Can you point me to a repo where we can reproduce this error?

hamelsmu commented 3 years ago

@muellerzr are you having any trouble with new nbdev projects?

muellerzr commented 3 years ago

The issue here is you’re likely either not using the most recent nbdev version while trying to use the old nbdev_template or vice versa. You should either bring in the new template and use it with the latest nbdev or @hamelsmu can you drop a link to the conversion script/directions?

On Wed, Jan 20, 2021 at 12:44 PM Hamel Husain notifications@github.com wrote:

@muellerzr https://github.com/muellerzr are you having any trouble with new nbdev projects?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fastai/nbdev_template/issues/31#issuecomment-763853978, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3YCV4DFS2PJFKIXBCUNBLS24QAXANCNFSM4WCLULTA .

hamelsmu commented 3 years ago

@urspb you are likely using the old template, can you try creating a brand new nbdev project, or using the script in the README to convert to the new template?

muellerzr commented 3 years ago

@urspb, Hamel and I worked on recreating your exact issue, so I'll try to explain what happened:

nbdev recently changed its template and how nbdev builds things. As a result we no longer have so much stuff in that docs/ folder. The exact issue here is you are using the latest nbdev_template but you aren't using the latest nbdev version (so your version is < 1.1.12). As a result you're experiencing this breaking change. So you should upgrade your version to 1.1.12 and it will run just fine.

hamelsmu commented 3 years ago

I'm going to go ahead and close this issue

urspb commented 3 years ago

@muellerzr your assumption is correct. I used nbdev version 1.1.11, which was the latest available on pypi.org at the time I first got the error. Thank you and @hamelsmu very much for your support and your efforts in this brilliant software.

lucharo commented 3 years ago

I can confirm that everything is working fine with the latest template and nbdev 1.1.12 thanks so much @hamelsmu !