Jupyter-book: Jupyterbook not building with sphinxcontrib-bibtex failure

Created on 13 Dec 2020  路  8Comments  路  Source: executablebooks/jupyter-book

I am unable to build a jupyter book with following error /home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/sphinxcontrib/bibtex/init.py

Steps taken :

  1. Created a new conda environment
  2. pip install -r requirements.txt

My requirements.txt

jupyter-book
pyreadline
plotly
plotly-express
plotnine
ipympl
altair
vega_datasets
bqplot
seaborn
  1. jb create tbook
  2. jb build tbook
  3. (Others) Tried adding bibtex_bibfiles in _config.yml with no success

(testjb) ubuntu@ip-10-134-194-166:/Landmark2/pdo/Code/ALDAOps/metis$ jb create tbook

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

Your book template can be found at

tbook/

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

(testjb) ubuntu@ip-10-134-194-166:/Landmark2/pdo/Code/ALDAOps/metis$ jb build tbook
Running Jupyter-Book v0.8.3
Source Folder: /Landmark2/pdo/Code/ALDAOps/metis/tbook
Config Path: /Landmark2/pdo/Code/ALDAOps/metis/tbook/_config.yml
Output Path: /Landmark2/pdo/Code/ALDAOps/metis/tbook/_build/html
Running Sphinx v3.3.1
making output directory... done
myst v0.12.10: MdParserConfig(renderer='sphinx', commonmark_only=False, dmath_enable=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, amsmath_enable=False, deflist_enable=False, update_mathjax=True, admonition_enable=False, figure_enable=False, disable_syntax=[], html_img_enable=False, url_schemes=['mailto', 'http', 'https'], heading_anchors=None)

Extension error:
You must configure the bibtex_bibfiles setting
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/jupyter_book/sphinx.py", line 110, in build_sphinx
app = Sphinx(
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/sphinx/application.py", line 278, in __init__
self._init_builder()
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/sphinx/application.py", line 337, in _init_builder
self.events.emit('builder-inited')
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/sphinx/events.py", line 110, in emit
results.append(listener.handler(self.app, *args))
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/sphinxcontrib/bibtex/__init__.py", line 45, in init_bibtex_cache
raise ExtensionError("You must configure the bibtex_bibfiles setting")
sphinx.errors.ExtensionError: You must configure the bibtex_bibfiles setting

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

Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/testjb/bin/jb", line 8, in
sys.exit(main())
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(args, *kwargs)
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, *ctx.params)
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(
args, **kwargs)
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/jupyter_book/commands/__init__.py", line 259, in build
builder_specific_actions(
File "/home/ubuntu/anaconda3/envs/testjb/lib/python3.9/site-packages/jupyter_book/commands/__init__.py", line 500, 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.

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

(testjb) ubuntu@ip-10-134-194-166:/Landmark2/pdo/Code/ALDAOps/metis$

upstream

Most helpful comment

Argg - this is because sphinx-bibtex just released a major version that's incompatible. I've pinned sphinxcontrib-bibtex to the 1.0 version on the master branch, and we'll get that into the next JB release. In the meantime just ensure that you have sphinxcontrib-bibtex 1.0 馃憤

@choldgraf correct! I've just tried it, the sphinxcontrib-bibtex version 1.0 works, 2.0 doesn't (this is installed by default).

For the rest of people in the thread:

just add sphinxcontrib-bibtex==1.0.0 in your requirements.txt

Edit: sphinxcontrib-bibtex<2.0.0 probably more correct

All 8 comments

I encountered the same problem in running Github Actions to build my site today, though versions are different.

Running Jupyter-Book v0.8.3
7
Source Folder: /home/runner/work/py4etrics.github.io/py4etrics.github.io
8
Config Path: /home/runner/work/py4etrics.github.io/py4etrics.github.io/_config.yml
9
Output Path: /home/runner/work/py4etrics.github.io/py4etrics.github.io/_build/html
10
Running Sphinx v3.3.1
11
myst v0.12.10: MdParserConfig(renderer='sphinx', commonmark_only=False, dmath_enable=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, amsmath_enable=False, deflist_enable=False, update_mathjax=True, admonition_enable=False, figure_enable=False, disable_syntax=[], html_img_enable=False, url_schemes=['mailto', 'http', 'https'], heading_anchors=None)
12

13
Extension error:
14
You must configure the bibtex_bibfiles setting
15
Traceback (most recent call last):
16
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/jupyter_book/sphinx.py", line 124, in build_sphinx
17
    keep_going=keep_going,
18
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/sphinx/application.py", line 278, in __init__
19
    self._init_builder()
20
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/sphinx/application.py", line 337, in _init_builder
21
    self.events.emit('builder-inited')
22
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/sphinx/events.py", line 110, in emit
23
    results.append(listener.handler(self.app, *args))
24
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/sphinxcontrib/bibtex/__init__.py", line 45, in init_bibtex_cache
25
    raise ExtensionError("You must configure the bibtex_bibfiles setting")
26
sphinx.errors.ExtensionError: You must configure the bibtex_bibfiles setting
27

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

30
Traceback (most recent call last):
31
  File "/opt/hostedtoolcache/Python/3.7.9/x64/bin/jupyter-book", line 8, in <module>
32
    sys.exit(main())
33
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 829, in __call__
34
    return self.main(*args, **kwargs)
35
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 782, in main
36
    rv = self.invoke(ctx)
37
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
38
    return _process_result(sub_ctx.command.invoke(sub_ctx))
39
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
40
    return ctx.invoke(self.callback, **ctx.params)
41
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 610, in invoke
42
    return callback(*args, **kwargs)
43
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/jupyter_book/commands/__init__.py", line 260, in build
44
    result, builder, OUTPUT_PATH, build_type, PAGE_NAME, click.echo
45
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/jupyter_book/commands/__init__.py", line 500, in builder_specific_actions
46
    raise RuntimeError(_message_box(msg, color="red", doprint=False)) from result
47
RuntimeError: 
48
===============================================================================
49

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

52
===============================================================================
53

54
Error: Process completed with exit code 1.

Same as @spring-haru here:

I got the ExtensionError("You must configure the bibtex_bibfiles setting") in gh-actions, using ubuntu-latest and Python 3.7.9.

Argg - this is because sphinx-bibtex just released a major version that's incompatible. I've pinned sphinxcontrib-bibtex to the 1.0 version on the master branch, and we'll get that into the next JB release. In the meantime just ensure that you have sphinxcontrib-bibtex 1.0 馃憤

Argg - this is because sphinx-bibtex just released a major version that's incompatible. I've pinned sphinxcontrib-bibtex to the 1.0 version on the master branch, and we'll get that into the next JB release. In the meantime just ensure that you have sphinxcontrib-bibtex 1.0 馃憤

@choldgraf correct! I've just tried it, the sphinxcontrib-bibtex version 1.0 works, 2.0 doesn't (this is installed by default).

For the rest of people in the thread:

just add sphinxcontrib-bibtex==1.0.0 in your requirements.txt

Edit: sphinxcontrib-bibtex<2.0.0 probably more correct

just add sphinxcontrib-bibtex==1.0.0 in your requirements.txt

And for those of us using something like poetry, the following is key:

sphinxcontrib-bibtex = {version = "<2.0.0"} 

I am having the same issue. Adding sphinxcontrib-bibtex<2.0.0 to requirements.txt should fix it for the moment.

Thank you for quick resolution. It seems to be working with pinning to version 1.0.0

I'm new to Jupyter Book, but maybe an entry could be added to the FAQ for new users who encounter this problem ? A simple quick and dirty fix without having to handle versions with pip is to add

sphinx:
  config:
    bibtex_bibfiles: "your_reference_file.bib"

in the _config.yml file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cedeerwe picture cedeerwe  路  3Comments

spring-haru picture spring-haru  路  5Comments

matrs picture matrs  路  3Comments

choldgraf picture choldgraf  路  5Comments

TomDonoghue picture TomDonoghue  路  4Comments