4

I had some minimal updates in the "source" folder and rebuilt the HTML using make html command. Everything works fine and I synced the folder to GitHub. However, when I was rebuilding the doc on the Read the Docs website, I got an error like this right after cat source/conf.py :

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

I just added some texts and fixed some typos in my documentation, nothing more. Why this error occurred and the build failed? Thanks.

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 303, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 228, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 449, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 472, in load_extension
    mod = __import__(extname, None, None, ['setup'])
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbsphinx.py", line 41, in <module>
    import nbconvert
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/__init__.py", line 4, in <module>
    from .exporters import *
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/exporters/__init__.py", line 4, in <module>
    from .slides import SlidesExporter
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/exporters/slides.py", line 12, in <module>
    from ..preprocessors.base import Preprocessor
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/preprocessors/__init__.py", line 7, in <module>
    from .csshtmlheader import CSSHTMLHeaderPreprocessor
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/nbconvert/preprocessors/csshtmlheader.py", line 14, in <module>
    from jupyterlab_pygments import JupyterStyle
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/jupyterlab_pygments/__init__.py", line 4, in <module>
    from .style import JupyterStyle
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/jupyterlab_pygments/style.py", line 10, in <module>
    class JupyterStyle(Style):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/site-packages/pygments/style.py", line 101, in __new__
    ndef[0] = colorformat(styledef)
  File "/home/docs/checkouts/readthedocs.org/user_builds/pkg_name/envs/latest/lib/python3.7/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/pkg_name/envs/latest/lib/python3.7/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-scp_kb7h.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!
Roshin Raphel
  • 2,612
  • 4
  • 22
  • 40
Neo
  • 482
  • 5
  • 17
  • You will need to provide a lot more details, but the easiest thing would be to provide a link to the RTD build page. Otherwise search the Internet for `AssertionError: wrong color format`. – Steve Piercy Sep 11 '20 at 03:45
  • I added some snippet, I am not sure if they are what you asking for. Thanks. – Neo Sep 11 '20 at 04:24
  • The stack trace confirms that there is something in Pygments or deeper in the stack that does not like the color format you specified, probably due to the language selection for highlighting. My search advice still applies. – Steve Piercy Sep 11 '20 at 07:00
  • I suspect I am having the exact same problem: a very simple change in the docs which builds correctly in my local machine, leads to errors regarding colours in RTD. Here is a link to the RTD build page: https://readthedocs.org/projects/imagine-code/builds/11860304/ – LuizFelippe Sep 11 '20 at 13:12
  • Yes, I was stuck at exactly the same place. Everything works fine in the local machine, but when I was building it on Read the Docs, it raised the wrong color issue. Have you figured out how to fix the issue? – Neo Sep 11 '20 at 13:31

4 Answers4

3

I had this issue with iPython notebooks since I had an old version of Pygments. Upgrade Pygments with

pip3 install --upgrade Pygments
qwr
  • 9,525
  • 5
  • 58
  • 102
2

I was also suffering from the same.In my case that raise due to beacause i update the notebook to the lastest version and left the conda itself to a very old one so it may cause a problem but whem i ran code: pip3 install Pygments==2.6.1it worked perfectly fine for me

Devesh
  • 21
  • 2
1

This seems to be related to the version of Pygments one is using (see this GitHub issue for details), which needs to be greater than 2.4.1.

In my case, the problem was solved by requiring ReadTheDocs to use: Pygments==2.6.1

LuizFelippe
  • 172
  • 9
0

I was facing the same issue. For me this got solved by following the steps in Python command fails with AssertionError: wrong color format, basically by installing nbconvert==6.0.0rc0. Thanks

PyAndy
  • 83
  • 1
  • 2
  • 8