ImportError: cannot import name 'contextfunction' from 'jinja2'
thanos opened this issue · 0 comments
thanos commented
- Date you used Cookiecutter PyPackage:
2022-08-24
- Cookiecutter version used, if any:
cookiecutter==2.1.1
- Python version, if any:
Python 3.10.5
- Operating System:
OSX 12.4
- jinja2 (3.0.3)
• mkdocstrings (0.15.2)
Description
poetry run tox
fails on build run-test: commands[1] | mkdocs build
:
build run-test: commands[1] | mkdocs build
Traceback (most recent call last):
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocs/__main__.py", line 192, in build_command
build.build(config.load_config(**kwargs), dirty=not clean)
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocs/config/base.py", line 224, in load_config
errors, warnings = cfg.validate()
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocs/config/base.py", line 108, in validate
run_failed, run_warnings = self._validate()
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocs/config/base.py", line 63, in _validate
self[key] = config_option.validate(value)
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocs/config/config_options.py", line 132, in validate
return self.run_validation(value)
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocs/config/config_options.py", line 690, in run_validation
plgins[item] = self.load_plugin(item, cfg)
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocs/config/config_options.py", line 703, in load_plugin
Plugin = self.installed_plugins[name].load()
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/importlib_metadata/__init__.py", line 203, in load
module = import_module(match.group('module'))
File "/Users/thanos/.asdf/installs/python/3.10.5/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocstrings/plugin.py", line 24, in <module>
from mkdocstrings.extension import MkdocstringsExtension
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocstrings/extension.py", line 38, in <module>
from mkdocstrings.handlers.base import CollectionError, CollectorItem, Handlers
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocstrings/handlers/base.py", line 27, in <module>
from mkdocstrings.loggers import get_template_logger
File "/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/mkdocstrings/loggers.py", line 7, in <module>
from jinja2 import contextfunction
ImportError: cannot import name 'contextfunction' from 'jinja2' (/Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/lib/python3.10/site-packages/jinja2/__init__.py)
ERROR: InvocationError for command /Users/thanos/work/locust/locust-web3/v/locust_web3/.tox/build/bin/mkdocs build (exited with code 1)
What I Did
poetry run tox