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

extendMarkdown() missing 1 required positional argument: 'md_globals' #9461

Closed
n3t opened this issue Jul 31, 2022 · 8 comments
Closed

extendMarkdown() missing 1 required positional argument: 'md_globals' #9461

n3t opened this issue Jul 31, 2022 · 8 comments
Labels
Accepted Accepted issue on our roadmap Bug A bug

Comments

@n3t
Copy link

n3t commented Jul 31, 2022

Details

Expected Result

Project build

Actual Result

ERROR - Error reading page 'index.md': extendMarkdown() missing 1 required positional argument: 'md_globals'

Build 2 weeks ago passed, todays build gives this error. No change in index.md file, no change in project configuration. Locally I am able to build.

@humitos
Copy link
Member

humitos commented Aug 1, 2022

Hi @n3t! Make sure you are using the exact same versions of your dependencies locally than on Read the Docs. In particular, Markdown, which in Read the Docs is being installed version 3.4.1.

I recommend you to follow this guide to avoid this kind of breaking build in the future: https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html

@humitos humitos added Support Support question Needed: more information A reply from issue author is required labels Aug 1, 2022
@JPGlaser
Copy link

JPGlaser commented Aug 1, 2022

Hey @humitos I am experiencing the same issue with my builds as well using MkDocs.

I have everything set up and it builds perfectly fine locally after I add in the Jinja2==3.0.3 work around

See the project here for details: https://github.com/WVU-GWaC/hpc-docs/tree/main

I am using the default readthedocs environment with the following versions being installed:

Successfully installed Jinja2-3.0.3 Markdown-3.4.1 MarkupSafe-2.1.1 PyYAML-6.0 Pygments-2.12.0 alabaster-0.7.12 babel-2.10.3 certifi-2022.6.15 charset-normalizer-2.1.0 click-8.1.3 commonmark-0.8.1 docutils-0.19 future-0.18.2 idna-3.3 imagesize-1.4.1 importlib-metadata-4.12.0 livereload-2.6.3 mkdocs-1.0.4 mock-1.0.1 packaging-21.3 pillow-5.4.1 pyparsing-3.0.9 pytz-2022.1 recommonmark-0.5.0 requests-2.28.1 six-1.16.0 snowballstemmer-2.2.0 sphinx-5.1.1 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-2.0.0 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.5 tornado-6.2 urllib3-1.26.11 zipp-3.8.1

~ Joe G.

INFO    -  Cleaning site directory 
INFO    -  Building documentation to directory: /home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/checkouts/latest/_build/html 
ERROR   -  Error reading page 'index.md': extendMarkdown() missing 1 required positional argument: 'md_globals' 
Traceback (most recent call last):
  File "/home/docs/.asdf/installs/python/3.9.13/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/docs/.asdf/installs/python/3.9.13/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/mkdocs/__main__.py", line 202, in <module>
    cli()
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/mkdocs/__main__.py", line 157, in build_command
    build.build(config.load_config(
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/mkdocs/commands/build.py", line 274, in build
    _populate_page(file.page, config, files, dirty)
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/mkdocs/commands/build.py", line 177, in _populate_page
    page.render(config, files)
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/mkdocs/structure/pages.py", line 180, in render
    md = markdown.Markdown(
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/markdown/core.py", line 96, in __init__
    self.registerExtensions(extensions=kwargs.get('extensions', []),
  File "/home/docs/checkouts/readthedocs.org/user_builds/gwac-docs/envs/latest/lib/python3.9/site-packages/markdown/core.py", line 125, in registerExtensions
    ext.extendMarkdown(self)
TypeError: extendMarkdown() missing 1 required positional argument: 'md_globals'

@JPGlaser
Copy link

JPGlaser commented Aug 2, 2022

Just an FYI @n3t , I have MkDocs building now by adding the following to a requirements.txt and adding that to the .readthedocs.yaml:

jinja2==3.0.3
mkdocs>=1.3.1
babel>=2.9.0
click>=7.0
Jinja2>=2.10.2
Markdown>=3.2.1,<3.4
PyYAML>=5.2
watchdog>=2.0.0
mdx_gh_links>=0.2
ghp-import>=1.0
pyyaml_env_tag>=0.1
mkdocs-redirects>=1.0.1
importlib_metadata>=4.3
packaging>=20.5
mergedeep>=1.3.4
pygments>=2.12
pymdown-extensions
mkdocs-material

~ Joe G.

@humitos
Copy link
Member

humitos commented Aug 2, 2022

I think we should pin the version of Jinja2 in the default environment to a version that is compatible with the current mkdocs version. In #9037 (comment) we solve this for Sphinx but it seems that we didn't for MkDocs.

@humitos humitos added Bug A bug Accepted Accepted issue on our roadmap and removed Support Support question Needed: more information A reply from issue author is required labels Aug 2, 2022
@humitos humitos moved this to Planned in 📍Roadmap Aug 2, 2022
@n3t
Copy link
Author

n3t commented Aug 2, 2022

Thank you @JPGlaser your requirments.txt works out of box for me, you saved me a lot of time.

@Vini2
Copy link

Vini2 commented Aug 3, 2022

Thank you so much @JPGlaser! Your requirments.txt worked like a charm for all my projects which have been failing to build.

@JPGlaser
Copy link

JPGlaser commented Aug 5, 2022

Glad to see it helped out @n3t and @Vini2 . It seems the mkdocs folks are aware of it and suggested pinning the version until Jinja2 comes into compliance with offering legacy decorators.

~ Joe G.

@humitos
Copy link
Member

humitos commented Aug 8, 2022

I'm going to close this issue because it's not a bug on Read the Docs, but a pinning dependency problem that can be solved by the user. However, if you think there is any actionable on the Read the Docs side, feel free to comment here what is that action that Read the Docs should do. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug A bug
Projects
Archived in project
Development

No branches or pull requests

4 participants