Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear error message when both MyST-NB and MyST-parser are enabled #653

Open
liz-is opened this issue Jan 20, 2025 · 0 comments
Open

Unclear error message when both MyST-NB and MyST-parser are enabled #653

liz-is opened this issue Jan 20, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@liz-is
Copy link

liz-is commented Jan 20, 2025

Describe the bug

context
When I enabled MyST-NB on a project that was already using MyST parser, I got a rather cryptic error message.

expectation
I expected to be able to have both extensions enabled at the same time, since MyST-NB uses the MyST parser.

bug
This is the Sphinx log with the error message:

# Platform:         darwin; (macOS-14.7.1-arm64-arm-64bit)
# Sphinx version:   8.1.3
# Python version:   3.12.4 (CPython)
# Docutils version: 0.21.2
# Jinja2 version:   3.1.5
# Pygments version: 2.18.0

# Last messages:


# Loaded extensions:


# Traceback:
Traceback (most recent call last):
  File "/Users/.venv/lib/python3.12/site-packages/sphinx/cmd/build.py", line 496, in build_main
    app = Sphinx(
          ^^^^^^^
  File "/Users/.venv/lib/python3.12/site-packages/sphinx/application.py", line 256, in __init__
    self.setup_extension(extension)
  File "/Users/.venv/lib/python3.12/site-packages/sphinx/application.py", line 437, in setup_extension
    self.registry.load_extension(self, extname)
  File "/Users/.venv/lib/python3.12/site-packages/sphinx/registry.py", line 466, in load_extension
    metadata = setup(app)
               ^^^^^^^^^^
  File "/Users/.venv/lib/python3.12/site-packages/myst_nb/__init__.py", line 10, in setup
    return sphinx_setup(app)
           ^^^^^^^^^^^^^^^^^
  File "/Users/.venv/lib/python3.12/site-packages/myst_nb/sphinx_ext.py", line 49, in sphinx_setup
    setup_myst_parser(app)
  File "/Users/.venv/lib/python3.12/site-packages/myst_parser/sphinx_ext/main.py", line 49, in setup_sphinx
    app.registry.transforms.remove(SphinxUnreferencedFootnotesDetector)
ValueError: list.remove(x): x not in list

problem
This is the same issue as discussed here. The solution is to only enable MyST-NB, not both at the same time. However this is not obvious from the error message, and there's no mention of this on the MyST-NB "getting started" page. It would be good to have a more informative error message and/or this mentioned in the documentation, as I'm sure there will be other people with the same issue. I was close to giving up on using MyST-NB until I found the issue linked above!

Reproduce the bug

# in conf.py
extensions = [
    "myst_parser",
    "myst_nb"
]

List your environment

myst_nb version '1.1.2'
myst_parser version '4.0.0'

@liz-is liz-is added the bug Something isn't working label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant