How to compile notebooks containing Julia code? #1027
-
So, I followed the steps given on the official docs to install jupyter book via pip. How do I compile notebooks containing Julia code. Is there a way to simply put the location of the Julia kernel? Right now, It is saying the following during the build.
Here is the full message: ╭─ ~/Desktop/repos/Julia-for-HPC main !1 ?1 ✔ jupyter_env base
╰─ jupyter-book build --all docs/
Running Jupyter-Book v0.15.1
Source Folder: /home/hell/Desktop/repos/Julia-for-HPC/docs
Config Path: /home/hell/Desktop/repos/Julia-for-HPC/docs/_config.yml
Output Path: /home/hell/Desktop/repos/Julia-for-HPC/docs/_build/html
[sphinxcontrib-bibtex] Beware that docutils versions 0.18 and 0.19 (you are running 0.18.1) are known to generate invalid html for citations. If this issue affects you, please use docutils<0.18 (or >=0.20 once released) instead. For more details, see https://sourceforge.net/p/docutils/patches/195/
Running Sphinx v5.0.2
[etoc] Changing master_doc to 'intro'
checking bibtex cache... out of date
parsing bibtex file /home/hell/Desktop/repos/Julia-for-HPC/docs/jupyter-book-template/references.bib... parsed 5 entries
myst v0.18.1: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions=['colon_fence', 'dollarmath', 'linkify', 'substitution', 'tasklist'], disable_syntax=[], all_links_external=False, url_schemes=['mailto', 'http', 'https'], ref_domains=None, highlight_code_blocks=True, number_code_blocks=[], title_to_header=False, heading_anchors=None, heading_slug_func=None, footnote_transition=True, words_per_minute=200, sub_delimiters=('{', '}'), linkify_fuzzy_links=True, 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')
myst-nb v0.17.2: NbParserConfig(custom_formats={}, metadata_key='mystnb', cell_metadata_key='mystnb', kernel_rgx_aliases={}, execution_mode='force', execution_cache_path='', execution_excludepatterns=[], execution_timeout=30, execution_in_temp=False, execution_allow_errors=False, execution_raise_on_error=False, execution_show_tb=False, merge_streams=False, render_plugin='default', remove_code_source=False, remove_code_outputs=False, code_prompt_show='Show code cell {type}', code_prompt_hide='Hide code cell {type}', number_source_lines=False, output_stderr='show', render_text_lexer='myst-ansi', render_error_lexer='ipythontb', render_image_options={}, render_figure_options={}, render_markdown_format='commonmark', output_folder='build', append_css=True, metadata_to_fm=False)
Using jupyter-cache at: /home/hell/Desktop/repos/Julia-for-HPC/docs/_build/.jupyter_cache
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 6 source files that are out of date
updating environment: [new config] 6 added, 0 changed, 0 removed
/home/hell/Desktop/repos/Julia-for-HPC/docs/Installation_and_management/install.ipynb: Executing notebook using local CWD [mystnb]
/home/hell/Desktop/repos/Julia-for-HPC/docs/Installation_and_management/install.ipynb: Executed notebook in 1.39 seconds [mystnb]
/home/hell/Desktop/repos/Julia-for-HPC/docs/basics/1. basic operations and functions.ipynb: Executing notebook using local CWD [mystnb]
Exception occurred:
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_client/kernelspec.py", line 287, in get_kernel_spec
raise NoSuchKernel(kernel_name)
jupyter_client.kernelspec.NoSuchKernel: No such kernel named julia-1.9
The full traceback has been saved in /tmp/sphinx-err-njoa2egp.log, if you want to report the issue to the developers.
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 "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_book/sphinx.py", line 171, in build_sphinx
app.build(force_all, filenames)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/sphinx/application.py", line 329, in build
self.builder.build_update()
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 288, in build_update
self.build(to_build,
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 302, in build
updated_docnames = set(self.read())
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 409, in read
self._read_serial(docnames)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 430, in _read_serial
self.read_doc(docname)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 483, in read_doc
publisher.publish()
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/docutils/core.py", line 217, in publish
self.document = self.reader.read(self.source, self.parser,
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/sphinx/io.py", line 103, in read
self.parse()
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/docutils/readers/__init__.py", line 78, in parse
self.parser.parse(self.input, document)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/myst_nb/sphinx_.py", line 150, in parse
with create_client(
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/myst_nb/core/execute/base.py", line 83, in __enter__
self.start_client()
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/myst_nb/core/execute/direct.py", line 40, in start_client
result = single_nb_execution(
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_cache/executors/utils.py", line 58, in single_nb_execution
executenb(
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/nbclient/client.py", line 1305, in execute
return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_core/utils/__init__.py", line 166, in wrapped
return loop.run_until_complete(inner)
File "/home/hell/anaconda3/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/nbclient/client.py", line 689, in async_execute
async with self.async_setup_kernel(**kwargs):
File "/home/hell/anaconda3/lib/python3.9/contextlib.py", line 181, in __aenter__
return await self.gen.__anext__()
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/nbclient/client.py", line 644, in async_setup_kernel
await self.async_start_new_kernel(**kwargs)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/nbclient/client.py", line 546, in async_start_new_kernel
await ensure_async(self.km.start_kernel(extra_arguments=self.extra_arguments, **kwargs))
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_core/utils/__init__.py", line 182, in ensure_async
result = await obj
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_client/manager.py", line 93, in wrapper
raise e
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_client/manager.py", line 85, in wrapper
out = await method(self, *args, **kwargs)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_client/manager.py", line 397, in _async_start_kernel
kernel_cmd, kw = await self._async_pre_start_kernel(**kw)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_client/manager.py", line 359, in _async_pre_start_kernel
self.kernel_spec,
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_client/manager.py", line 182, in kernel_spec
self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_client/kernelspec.py", line 287, in get_kernel_spec
raise NoSuchKernel(kernel_name)
jupyter_client.kernelspec.NoSuchKernel: No such kernel named julia-1.9
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/bin/jupyter-book", line 8, in <module>
sys.exit(main())
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_book/cli/main.py", line 317, in build
builder_specific_actions(
File "/home/hell/Desktop/repos/Julia-for-HPC/jupyter_env/lib/python3.9/site-packages/jupyter_book/cli/main.py", line 525, in builder_specific_actions
raise RuntimeError(_message_box(msg, color="red", doprint=False)) from result
RuntimeError:
===============================================================================
There was an error in building your book. Look above for the cause.
=============================================================================== |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
We faced similar problems when we worked with Julia installed within a virtual environment (installed via Conda). Seems that Jupyter/MyST-NB does not recognise the Julia kernel if Julia is not installed system-wide. See here for how we got it to work: https://compwa-org.rtfd.io/develop.html#ijulia-notebooks |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot. Now I can start writing the docs again. :) |
Beta Was this translation helpful? Give feedback.
We faced similar problems when we worked with Julia installed within a virtual environment (installed via Conda). Seems that Jupyter/MyST-NB does not recognise the Julia kernel if Julia is not installed system-wide. See here for how we got it to work: https://compwa-org.rtfd.io/develop.html#ijulia-notebooks