jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

The template book doesn't get built following the tutorial

Open schwabts opened this issue 2 years ago • 4 comments

Describe the bug

It's below in sections context, expectation, and bug.

But even if the template book would get built it would not help me to get started with the directives of sphinx-proof.

  • Where can I check out a template for a ( / an interactive) Jupyter Book using sphinx-proof?

context When I do

  1. jupyter-book create mynewbook/ and
  2. jupyter-book build mynewbook/

as shown in the tutorial Create your first book.

expectation I expected a a fully-functioning (and almost empty) HTML site to get generated assuming a usable default book’s structure to be defined in _toc.yml by default.

bug But instead there was a RuntimeError that resulted from a NotImplementedError exception.

Here's an error message I ran into...

$ jupyter-book create mynewbook/

←[92m===============================================================================←[0m

Your book template can be found at

    mynewbook\

←[92m===============================================================================←[0m


$ jupyter-book build mynewbook/
Running Jupyter-Book v0.13.0
Source Folder: ...\mynewbook
Config Path: ...\mynewbook\_config.yml
Output Path: ...\mynewbook\_build\html
←[01mRunning Sphinx v4.0.1←[39;49;00m
←[01mmaking output directory... ←[39;49;00mdone
[etoc] Changing master_doc to 'intro'
checking bibtex cache... out of date
parsing bibtex file ...\mynewbook\references.bib... parsed 5 entries
←[01mmyst v0.15.2:←[39;49;00m MdParserConfig(renderer='sphinx', commonmark_only=False, enable_extensions=['colon_fence', 'dollarmath', 'linkify', 'substitution', 'tasklist'], dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', disable_syntax=[], url_schemes=['mailto', 'http', 'https'], heading_anchors=None, heading_slug_func=None, html_meta=[], footnote_transition=True, substitutions=[], sub_delimiters=['{', '}'], words_per_minute=200)
←[01mbuilding [mo]: ←[39;49;00mtargets for 0 po files that are out of date
←[01mbuilding [html]: ←[39;49;00mtargets for 4 source files that are out of date
←[01mupdating environment: ←[39;49;00m[new config] 4 added, 0 changed, 0 removed
Executing: markdown-notebooks in: ...\mynewbook

←[91mException occurred:←[39;49;00m
  File "c:\programdata\anaconda3\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError
NotImplementedError
←[91mThe full traceback has been saved in ...\AppData\Local\Temp\sphinx-err-kizo1bzv.log, if you want to report the issue to the developers.←[39;49;00m
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_book\sphinx.py", line 167, in build_sphinx
    app.build(force_all, filenames)
  File "c:\programdata\anaconda3\lib\site-packages\sphinx\application.py", line 350, in build
    self.builder.build_update()
  File "c:\programdata\anaconda3\lib\site-packages\sphinx\builders\__init__.py", line 292, in build_update
    self.build(to_build,
  File "c:\programdata\anaconda3\lib\site-packages\sphinx\builders\__init__.py", line 306, in build
    updated_docnames = set(self.read())
  File "c:\programdata\anaconda3\lib\site-packages\sphinx\builders\__init__.py", line 413, in read
    self._read_serial(docnames)
  File "c:\programdata\anaconda3\lib\site-packages\sphinx\builders\__init__.py", line 434, in _read_serial
    self.read_doc(docname)
  File "c:\programdata\anaconda3\lib\site-packages\sphinx\builders\__init__.py", line 474, in read_doc
    doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
  File "c:\programdata\anaconda3\lib\site-packages\sphinx\io.py", line 188, in read_doc
    pub.publish()
  File "C:\Users\schwa\AppData\Roaming\Python\Python38\site-packages\docutils\core.py", line 217, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "c:\programdata\anaconda3\lib\site-packages\sphinx\io.py", line 108, in read
    self.parse()
  File "C:\Users\schwa\AppData\Roaming\Python\Python38\site-packages\docutils\readers\__init__.py", line 78, in parse
    self.parser.parse(self.input, document)
  File "c:\programdata\anaconda3\lib\site-packages\myst_nb\parser.py", line 67, in parse
    ntbk = generate_notebook_outputs(
  File "c:\programdata\anaconda3\lib\site-packages\myst_nb\execution.py", line 137, in generate_notebook_outputs
    result = single_nb_execution(
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_cache\executors\utils.py", line 51, in single_nb_execution
    executenb(
  File "c:\programdata\anaconda3\lib\site-packages\nbclient\client.py", line 1112, in execute
    return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
  File "c:\programdata\anaconda3\lib\site-packages\nbclient\util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "c:\programdata\anaconda3\lib\site-packages\nbclient\util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "c:\programdata\anaconda3\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "c:\programdata\anaconda3\lib\site-packages\nbclient\client.py", line 537, in async_execute
    async with self.async_setup_kernel(**kwargs):
  File "c:\programdata\anaconda3\lib\site-packages\async_generator\_util.py", line 34, in __aenter__
    return await self._agen.asend(None)
  File "c:\programdata\anaconda3\lib\site-packages\nbclient\client.py", line 496, in async_setup_kernel
    await self.async_start_new_kernel_client()
  File "c:\programdata\anaconda3\lib\site-packages\nbclient\client.py", line 421, in async_start_new_kernel_client
    await ensure_async(self.kc.start_channels())
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_client\client.py", line 106, in start_channels
    self.iopub_channel.start()
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_client\client.py", line 162, in iopub_channel
    socket = self.connect_iopub()
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_client\connect.py", line 558, in connect_iopub
    sock = self._create_connected_socket('iopub', identity=identity)
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_client\connect.py", line 548, in _create_connected_socket
    sock = self.context.socket(socket_type)
  File "c:\programdata\anaconda3\lib\site-packages\zmq\sugar\context.py", line 226, in socket
    s = self._socket_class(self, socket_type, **kwargs)
  File "c:\programdata\anaconda3\lib\site-packages\zmq\_future.py", line 144, in __init__
    self._init_io_state()
  File "c:\programdata\anaconda3\lib\site-packages\zmq\asyncio.py", line 56, in _init_io_state
    self.io_loop.add_reader(self._fd, lambda: self._handle_events(0, 0))
  File "c:\programdata\anaconda3\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError
NotImplementedError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\programdata\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\Scripts\jupyter-book.exe\__main__.py", line 7, in <module>
  File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_book\cli\main.py", line 323, in build
    builder_specific_actions(
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_book\cli\main.py", line 531, in builder_specific_actions
    raise RuntimeError(_message_box(msg, color="red", doprint=False)) from result
RuntimeError:
←[91m===============================================================================←[0m

There was an error in building your book. Look above for the cause.

←[91m===============================================================================←[0m

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\site-packages\nbclient\client.py", line 378, in _async_cleanup_kernel
    await ensure_async(self.kc.stop_channels())
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_client\client.py", line 124, in stop_channels
    if self.shell_channel.is_alive():
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_client\client.py", line 150, in shell_channel
    socket = self.connect_shell(identity=self.session.bsession)
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_client\connect.py", line 564, in connect_shell
    return self._create_connected_socket('shell', identity=identity)
  File "c:\programdata\anaconda3\lib\site-packages\jupyter_client\connect.py", line 548, in _create_connected_socket
    sock = self.context.socket(socket_type)
  File "c:\programdata\anaconda3\lib\site-packages\zmq\sugar\context.py", line 226, in socket
    s = self._socket_class(self, socket_type, **kwargs)
  File "c:\programdata\anaconda3\lib\site-packages\zmq\_future.py", line 144, in __init__
    self._init_io_state()
  File "c:\programdata\anaconda3\lib\site-packages\zmq\asyncio.py", line 56, in _init_io_state
    self.io_loop.add_reader(self._fd, lambda: self._handle_events(0, 0))
  File "c:\programdata\anaconda3\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError
NotImplementedError
Exception ignored in: <function Socket.__del__ at 0x000001DAFAB7FCA0>
Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\site-packages\zmq\sugar\socket.py", line 68, in __del__
    self.close()
  File "c:\programdata\anaconda3\lib\site-packages\zmq\_future.py", line 160, in close
    self._clear_io_state()
  File "c:\programdata\anaconda3\lib\site-packages\zmq\asyncio.py", line 63, in _clear_io_state
    self.io_loop.remove_reader(self._fd)
  File "c:\programdata\anaconda3\lib\asyncio\events.py", line 504, in remove_reader
    raise NotImplementedError
NotImplementedError:
Exception ignored in: <function Socket.__del__ at 0x000001DAFAB7FCA0>
Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\site-packages\zmq\sugar\socket.py", line 68, in __del__
  File "c:\programdata\anaconda3\lib\site-packages\zmq\_future.py", line 160, in close
  File "c:\programdata\anaconda3\lib\site-packages\zmq\asyncio.py", line 63, in _clear_io_state
  File "c:\programdata\anaconda3\lib\asyncio\events.py", line 504, in remove_reader
NotImplementedError:

$

Reproduce the bug

  1. jupyter-book create mynewbook/
  2. jupyter-book build mynewbook/

List your environment

Jupyter Book : 0.13.0 External ToC : 0.2.4 MyST-Parser : 0.15.2 MyST-NB : 0.13.2 Sphinx Book Theme : 0.3.3 Jupyter-Cache : 0.4.3 NbClient : 0.5.3

schwabts avatar Jul 22 '22 09:07 schwabts

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Jul 22 '22 09:07 welcome[bot]

Hi @schwabts,

I just tried this and it seems to work for me.

I tried:

jb create test1
cd test1
jb build .

and I got the following output:

Output
Running Jupyter-Book v0.13.0
Source Folder: /Users/firasm/junk/test1
Config Path: /Users/firasm/junk/test1/_config.yml
Output Path: /Users/firasm/junk/test1/_build/html
Running Sphinx v4.5.0
[etoc] Changing master_doc to 'intro'
loading pickled environment... checking bibtex cache... up to date
done
myst v0.15.2: MdParserConfig(renderer='sphinx', commonmark_only=False, enable_extensions=['colon_fence', 'dollarmath', 'linkify', 'substitution', 'tasklist'], dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', disable_syntax=[], url_schemes=['mailto', 'http', 'https'], heading_anchors=None, heading_slug_func=None, html_meta=[], footnote_transition=True, substitutions=[], sub_delimiters=['{', '}'], words_per_minute=200)
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded.

The HTML pages are in _build/html.

===============================================================================

Finished generating HTML for book.
Your book's HTML pages are here:
    _build/html/
You can look at your book by opening this file in a browser:
    _build/html/index.html
Or paste this line directly into your browser bar:
    file:///Users/firasm/junk/test1/_build/html/index.html            

===============================================================================

Here's the output of jb --version:

▶ jb --version                      
Jupyter Book      : 0.13.0
External ToC      : 0.2.4
MyST-Parser       : 0.15.2
MyST-NB           : 0.13.2
Sphinx Book Theme : 0.3.2
Jupyter-Cache     : 0.4.3
NbClient          : 0.5.12

Perhaps you could try reinstalling jupyterbook just to make sure one of its dependencies didn't get downgraded in another installation?

firasm avatar Jul 27 '22 03:07 firasm

@firasm - can you try replicating again? jb create test1 && jb build test1 do not seem to work as I try to show in #1805

Jupyter Book      : 0.13.0
External ToC      : 0.2.4
MyST-Parser       : 0.18.0
MyST-NB           : 0.16.0
Sphinx Book Theme : 0.3.3
Jupyter-Cache     : 0.5.0
NbClient          : 0.5.13
# sphinx-build --version
sphinx-build 5.1.1

I suspect something changed in sphinx 5.1.1 that is not matched by default _config.yml.

epogrebnyak avatar Aug 13 '22 08:08 epogrebnyak

Hi @epogrebnyak I don't believe jupyter-book is yet compatible with Sphinx 5.x

I am currently on 4.5.0

sphinx-build --version
sphinx-build 4.5.0

firasm avatar Aug 13 '22 19:08 firasm