Fix some very minor issues and rebuild sphinx but got the error "wrong color format"

Viewed 1979

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!
4 Answers

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

pip3 install --upgrade Pygments

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

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

Related