Closed MarcoGorelli closed 3 years ago
The issue is that then, nbdev_build_lib
will also try building all of these (irrelevant) notebooks:
$ nbdev_build_docs
converting: /home/marco/learning_nbdev/index.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/exporters/tests/files/prompt_numbers.ipynb
converting: /home/marco/learning_nbdev/00_core.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/exporters/tests/files/attachment.ipynb
[Errno 2] No such file or directory: '/home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/exporters/tests/files/attachment:image.png'
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/exporters/tests/files/rawtest.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/exporters/tests/files/svg.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/exporters/tests/files/pngmetadata.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/exporters/tests/files/notebook2.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/notebook_jl.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/notebook1.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/notebook4_jpeg.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/latex-linked-image.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/markdown_display_priority.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/notebook2.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/notebook_tags.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/Widget_List.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/tests/files/notebook3_with_errors.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/SVG.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Disable Stdin.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Skip Exceptions with Cell Tags-IPY6.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/UnicodePy3.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Inline Image.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Skip Exceptions-IPY6.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Unicode.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Check History in Memory.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/JupyterWidgets.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Sleep One.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Interrupt.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Clear Output.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/update-display-id.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/HelloWorld.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Factorials.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Skip Exceptions with Cell Tags.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Parallel Execute A.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Parallel Execute B.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Interrupt-IPY6.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Skip Exceptions.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbconvert/preprocessors/tests/files/Empty Cell.ipynb
converting: /home/marco/learning_nbdev/venv/lib/python3.8/site-packages/notebook/bundler/tests/resources/empty.ipynb
Conversion failed on the following:
attachment.ipynb
Traceback (most recent call last):
File "/home/marco/learning_nbdev/venv/bin/nbdev_build_docs", line 8, in <module>
sys.exit(nbdev_build_docs())
File "/home/marco/learning_nbdev/venv/lib/python3.8/site-packages/fastcore/script.py", line 105, in _f
tfunc(**merge(args, args_from_prog(func, xtra)))
File "/home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbdev/export2html.py", line 665, in nbdev_build_docs
if fname is None: make_sidebar()
File "/home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbdev/export2html.py", line 730, in make_sidebar
create_default_sidebar()
File "/home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbdev/export2html.py", line 722, in create_default_sidebar
dic = {Config().lib_name: _create_default_sidebar()}
File "/home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbdev/export2html.py", line 714, in _create_default_sidebar
titles = [_get_title(f) for f in fnames if f.stem!='index']
File "/home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbdev/export2html.py", line 714, in <listcomp>
titles = [_get_title(f) for f in fnames if f.stem!='index']
File "/home/marco/learning_nbdev/venv/lib/python3.8/site-packages/nbdev/export2html.py", line 704, in _get_title
with open(fname, 'r') as f: code = f.read()
FileNotFoundError: [Errno 2] No such file or directory: '/home/marco/learning_nbdev/docs/attachment.html'
OK, got it, it's because it's trying to convert the notebooks in the venv
folder.
By instead making my virtualenv outside this repo, it works as expected:
$ virtualenv ~/virtualenvs/learning_nbdev
Could/should these be excluded by default?
Are you using the latest version of nbdev? Can you install the current version from github
pip install git+<URL>
This shouldn't be happening if recursive is set to false in settings.ini. I'm not able to reproduce this issue, even with your repo. Or even if I put a notebook into a nested folder, etc.
My only hypothesis is your version of nbdev
I was using the latest version of nbdev on PyPI (1.1.12)
Can you try
pip install -U git+https://github.com/fastai/nbdev.git
@MarcoGorelli can you provide a reproducible example that doesn't involve private files in your virtual env? A repo that we can use to reproduce this error would be helpful
Hi @hamelsmu - sure, I've force-added the ipynb files to the repo: https://github.com/MarcoGorelli/learning_nbdev , please let me know if you're able to reproduce
I tried installing nbdev via pip install -U git+https://github.com/fastai/nbdev.git
but the same thing happens
Thanks for providing the example, that really helped. I fixed this in https://github.com/fastai/nbdev/pull/433
cc: @jph00
I have cloned the nbdev template to https://github.com/MarcoGorelli/learning_nbdev
Then, in the terminal, I did:
However, the tutorial shows that the output should just be
Any idea what went wrong in my setup?