Sphinx: AssertionError: wrong color format 'var(--jp-mirror-editor-variable-color)'

Created on 11 Sep 2020  路  12Comments  路  Source: sphinx-doc/sphinx

Seems like there is an issue, maybe not necessarily a bug. I documented my package using Read the Docs a month ago and everything works fine. I recently added some texts and fixed some typos and rebuild the documentation on my local computer without encountering any issue. However, when I was trying to build the documentation on the Read the Docs, an error occurred:

AssertionError: wrong color format

I only added some texts and fixed typos, there is nothing I can remember that will cause errors. The same thing happened to another user as well, please see our issues here

I suspect this may be because of some updates or inconsistencies of packages? Please help us figure out the issue, Thanks.

question

Most helpful comment

Requiring RTD to use: Pygments==2.6.1 solved the issue for me.

All 12 comments

Just ran into this myself, also on read-the-docs.

Error log

Running Sphinx v3.2.1
loading translations [en]... done

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/sphinx/cmd/build.py", line 276, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/sphinx/application.py", line 244, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/sphinx/application.py", line 398, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/sphinx/registry.py", line 409, in load_extension
    mod = import_module(extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/nbsphinx.py", line 41, in <module>
    import nbconvert
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/nbconvert/__init__.py", line 4, in <module>
    from .exporters import *
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/nbconvert/exporters/__init__.py", line 4, in <module>
    from .slides import SlidesExporter
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/nbconvert/exporters/slides.py", line 12, in <module>
    from ..preprocessors.base import Preprocessor
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/nbconvert/preprocessors/__init__.py", line 7, in <module>
    from .csshtmlheader import CSSHTMLHeaderPreprocessor
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/nbconvert/preprocessors/csshtmlheader.py", line 14, in <module>
    from jupyterlab_pygments import JupyterStyle
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/jupyterlab_pygments/__init__.py", line 4, in <module>
    from .style import JupyterStyle
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/jupyterlab_pygments/style.py", line 10, in <module>
    class JupyterStyle(Style):
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/pygments/style.py", line 101, in __new__
    ndef[0] = colorformat(styledef)
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/pygments/style.py", line 58, in colorformat
    assert False, "wrong color format %r" % text
AssertionError: wrong color format 'var(--jp-mirror-editor-variable-color)'

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/pygments/style.py", line 58, in colorformat
    assert False, "wrong color format %r" % text
AssertionError: wrong color format 'var(--jp-mirror-editor-variable-color)'
The full traceback has been saved in /tmp/sphinx-err-nsclyuye.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!

python -m pip list

Package                       Version
----------------------------- ----------
alabaster                     0.7.12
argon2-cffi                   20.1.0
async-generator               1.10
attrs                         20.2.0
Babel                         2.8.0
backcall                      0.2.0
bleach                        3.1.5
certifi                       2020.6.20
cffi                          1.14.2
chardet                       3.0.4
clifford                      1.4.0.dev0
commonmark                    0.8.1
cycler                        0.10.0
decorator                     4.4.2
defusedxml                    0.6.0
docutils                      0.14
entrypoints                   0.3
future                        0.18.2
h5py                          2.10.0
idna                          2.10
imagesize                     1.2.0
ipykernel                     5.3.4
ipython                       7.18.1
ipython-genutils              0.2.0
ipywidgets                    7.5.1
jedi                          0.17.2
Jinja2                        2.11.2
jsonschema                    3.2.0
jupyter-client                6.1.7
jupyter-core                  4.6.3
jupyterlab-pygments           0.1.1
kiwisolver                    1.2.0
latexcodec                    2.0.1
llvmlite                      0.34.0
MarkupSafe                    1.1.1
matplotlib                    3.3.1
mistune                       0.8.4
mock                          1.0.1
mpl-toolkits.clifford         0.0.3
nbclient                      0.5.0
nbconvert                     6.0.1
nbformat                      5.0.7
nbsphinx                      0.7.1
nest-asyncio                  1.4.0
notebook                      6.1.4
numba                         0.51.2
numpy                         1.19.2
oset                          0.1.3
packaging                     20.4
pandas                        1.1.2
pandocfilters                 1.4.2
parso                         0.7.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        7.2.0
pip                           20.2.3
prometheus-client             0.8.0
prompt-toolkit                3.0.7
ptyprocess                    0.6.0
pybtex                        0.22.2
pybtex-docutils               0.2.2
pycparser                     2.20
pyganja                       0.0.12
Pygments                      2.3.1
pyparsing                     2.4.7
pyrsistent                    0.16.0
python-dateutil               2.8.1
pytz                          2020.1
PyYAML                        5.3.1
pyzmq                         19.0.2
readthedocs-sphinx-ext        1.0.4
recommonmark                  0.5.0
requests                      2.24.0
scipy                         1.5.2
Send2Trash                    1.5.0
setuptools                    50.3.0
six                           1.15.0
snowballstemmer               2.0.0
sparse                        0.11.2
Sphinx                        3.2.1
sphinx-rtd-theme              0.4.3
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-bibtex          1.0.0
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        1.0.3
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.4
sphinxcontrib-websupport      1.2.4
terminado                     0.8.3
testpath                      0.4.4
tornado                       6.0.4
traitlets                     5.0.4
trimesh                       3.8.6
urllib3                       1.25.10
wcwidth                       0.2.5
webencodings                  0.5.1
wheel                         0.35.1
widgetsnbextension            3.5.1

I think sphinx is not to blame here, but another dependency - the package diff since my last successful build is

@@ -2,7 +2,8 @@
 ----------------------------- ----------
 alabaster                     0.7.12
 argon2-cffi                   20.1.0
-attrs                         19.3.0
+async-generator               1.10
+attrs                         20.2.0
 Babel                         2.8.0
 backcall                      0.2.0
 bleach                        3.1.5
@@ -21,14 +22,15 @@
 idna                          2.10
 imagesize                     1.2.0
 ipykernel                     5.3.4
-ipython                       7.17.0
+ipython                       7.18.1
 ipython-genutils              0.2.0
 ipywidgets                    7.5.1
 jedi                          0.17.2
 Jinja2                        2.11.2
 jsonschema                    3.2.0
-jupyter-client                6.1.6
+jupyter-client                6.1.7
 jupyter-core                  4.6.3
+jupyterlab-pygments           0.1.1
 kiwisolver                    1.2.0
 latexcodec                    2.0.1
 llvmlite                      0.34.0
@@ -37,23 +39,25 @@
 mistune                       0.8.4
 mock                          1.0.1
 mpl-toolkits.clifford         0.0.3
-nbconvert                     5.6.1
+nbclient                      0.5.0
+nbconvert                     6.0.1
 nbformat                      5.0.7
 nbsphinx                      0.7.1
-notebook                      6.1.3
-numba                         0.51.0
-numpy                         1.19.1
+nest-asyncio                  1.4.0
+notebook                      6.1.4
+numba                         0.51.2
+numpy                         1.19.2
 oset                          0.1.3
 packaging                     20.4
-pandas                        1.1.0
+pandas                        1.1.2
 pandocfilters                 1.4.2
 parso                         0.7.1
 pexpect                       4.8.0
 pickleshare                   0.7.5
 Pillow                        7.2.0
-pip                           20.2.2
+pip                           20.2.3
 prometheus-client             0.8.0
-prompt-toolkit                3.0.6
+prompt-toolkit                3.0.7
 ptyprocess                    0.6.0
 pybtex                        0.22.2
 pybtex-docutils               0.2.2
@@ -71,10 +75,10 @@
 requests                      2.24.0
 scipy                         1.5.2
 Send2Trash                    1.5.0
-setuptools                    49.6.0
+setuptools                    50.3.0
 six                           1.15.0
 snowballstemmer               2.0.0
-sparse                        0.11.0
+sparse                        0.11.2
 Sphinx                        3.2.1
 sphinx-rtd-theme              0.4.3
 sphinxcontrib-applehelp       1.0.2
@@ -88,8 +92,8 @@
 terminado                     0.8.3
 testpath                      0.4.4
 tornado                       6.0.4
-traitlets                     4.3.3
-trimesh                       3.8.1
+traitlets                     5.0.4
+trimesh                       3.8.6
 urllib3                       1.25.10
 wcwidth                       0.2.5
 webencodings                  0.5.1

jupyterlab-pygments looks like the obvious suspect here.

Ah, here's the relevant build log:

jupyterlab-pygments 0.1.1 requires pygments<3,>=2.4.1, but you'll have pygments 2.3.1 which is incompatible.
nbconvert 6.0.1 requires pygments>=2.4.1, but you'll have pygments 2.3.1 which is incompatible.

So this is either a pip problem (for not being louder / doing the right thing), or a readthedocs problem (for forcing an old version of pygments to be installed in the first place). I recommend this issue be closed.

so your suggestion is to install pygments >= 2.4.1 (but should also <3)?

That was enough for me. Starting in october, pip may be clever enough to do this for you.

Thanks for your help. I will try it later on.

Hi, I reinstalled pygments==2.4.1, the same issue still persist.

same problem

It seems this error was came from jupyterlab_pygments. I think it would be better to move this issue to their project. Closing.

  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/jupyterlab_pygments/style.py", line 10, in <module>
    class JupyterStyle(Style):
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/pygments/style.py", line 101, in __new__
    ndef[0] = colorformat(styledef)
  File "/home/docs/checkouts/readthedocs.org/user_builds/clifford/envs/357/lib/python3.8/site-packages/pygments/style.py", line 58, in colorformat
    assert False, "wrong color format %r" % text
AssertionError: wrong color format 'var(--jp-mirror-editor-variable-color)'

Jupyterlab-pygments author here: this is not an issue with jupyterlab-pygments.

Requiring RTD to use: Pygments==2.6.1 solved the issue for me.

I notified readthedocs - they are working on the issue: https://github.com/readthedocs/readthedocs.org/issues/7492

Was this page helpful?
0 / 5 - 0 ratings