mailman-web migrate fails: KeyError: 'django'
Following the venv installation docs on a Debian 10 system, the command "mailman-web migrate" fails with a "KeyError: 'django'" error.
Output pasted below [1].
There's an earlier thread on this error [2] but I think the cause may be different. Even so, per Mark Sapiro's suggestion I changed STATIC_ROOT to /opt/mailman/mm/var/static in settings.py. In mailman.cfg, var_dir is at the default setting of /opt/mailman/mm/var/static.
I previously had tried creating /opt/mailman/mm/web/logs and chown'ing it to mailman, but "mailman-web migrate" failed with the same error.
FWIW, mailman-web and hyperkitty installation initially failed with the suggesting that I upgrade pip, which I did using " pip install --upgrade pip".
Thanks in advance for troubleshooting clues.
dn
[1] (venv) mailman@somehost:~$ mailman-web migrate Traceback (most recent call last): File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/utils.py", line 66, in __getitem__ return self._engines[alias] KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/backends/django.py", line 121, in get_package_libraries module = import_module(entry[1]) File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/opt/mailman/venv/lib/python3.7/site-packages/hyperkitty/templatetags/decorate.py", line 4, in <module> from hyperkitty.lib.renderer import markdown_renderer, text_renderer File "/opt/mailman/venv/lib/python3.7/site-packages/hyperkitty/lib/renderer.py", line 7, in <module> from mistune.scanner import escape_html, escape_url ImportError: cannot import name 'escape_html' from 'mistune.scanner' (/opt/mailman/venv/lib/python3.7/site-packages/mistune/scanner.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/mailman/venv/bin/mailman-web", line 8, in <module> sys.exit(main()) File "/opt/mailman/venv/lib/python3.7/site-packages/mailman_web/manage.py", line 30, in main execute_from_command_line(sys.argv) File "/opt/mailman/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/opt/mailman/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/mailman/venv/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "/opt/mailman/venv/lib/python3.7/site-packages/django/core/management/base.py", line 366, in execute self.check() File "/opt/mailman/venv/lib/python3.7/site-packages/django/core/management/base.py", line 395, in check include_deployment_checks=include_deployment_checks, File "/opt/mailman/venv/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 64, in _run_checks issues.extend(super()._run_checks(**kwargs)) File "/opt/mailman/venv/lib/python3.7/site-packages/django/core/management/base.py", line 382, in _run_checks return checks.run_checks(**kwargs) File "/opt/mailman/venv/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/opt/mailman/venv/lib/python3.7/site-packages/django/contrib/admin/checks.py", line 76, in check_dependencies for engine in engines.all(): File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/utils.py", line 90, in all return [self[alias] for alias in self] File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/utils.py", line 90, in <listcomp> return [self[alias] for alias in self] File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/utils.py", line 81, in __getitem__ engine = engine_cls(params) File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/backends/django.py", line 25, in __init__ options['libraries'] = self.get_templatetag_libraries(libraries) File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries libraries = get_installed_libraries() File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries for name in get_package_libraries(pkg): File "/opt/mailman/venv/lib/python3.7/site-packages/django/template/backends/django.py", line 125, in get_package_libraries "trying to load '%s': %s" % (entry[1], e) django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'hyperkitty.templatetags.decorate': cannot import name 'escape_html' from 'mistune.scanner' (/opt/mailman/venv/lib/python3.7/site-packages/mistune/scanner.py)
[2] https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/4...
On 12/6/21 6:10 PM, David Newman wrote:
Following the venv installation docs on a Debian 10 system, the command "mailman-web migrate" fails with a "KeyError: 'django'" error.
Output pasted below [1]. ... from mistune.scanner import escape_html, escape_url ImportError: cannot import name 'escape_html' from 'mistune.scanner'
You need to install https://gitlab.com/mailman/hyperkitty/-/merge_requests/379 or downgrade mistune in your venv with
pip install mistune==2.2.0rc1
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On 12/6/21 7:25 PM, Mark Sapiro wrote:
On 12/6/21 6:10 PM, David Newman wrote:
Following the venv installation docs on a Debian 10 system, the command "mailman-web migrate" fails with a "KeyError: 'django'" error.
Output pasted below [1]. ... from mistune.scanner import escape_html, escape_url ImportError: cannot import name 'escape_html' from 'mistune.scanner'
You need to install https://gitlab.com/mailman/hyperkitty/-/merge_requests/379 or downgrade mistune in your venv with
pip install mistune==2.2.0rc1
Thanks for this. I applied the one-line fix by hand from 379 and the command now runs clean.
I first tried the 'pip install' command but it returned this error:
venv) mailman@somehost:~ $ pip install mistune==2.2.0rc1 ERROR: Could not find a version that satisfies the requirement mistune==2.2.0rc1 (from versions: 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.4, 0.4.1, 0.5, 0.5.1, 0.6, 0.7, 0 .7.1, 0.7.2, 0.7.3, 0.7.4, 0.8, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 2.0.0a1, 2.0.0a2, 2.0.0a3, 2.0.0a4, 2.0.0a5, 2.0.0a6, 2.0.0rc1, 2.0.0) ERROR: No matching distribution found for mistune==2.2.0rc1
Thanks again.
dn
On 12/6/21 7:53 PM, David Newman wrote:
On 12/6/21 7:25 PM, Mark Sapiro wrote:
You need to install https://gitlab.com/mailman/hyperkitty/-/merge_requests/379 or downgrade mistune in your venv with
pip install mistune==2.2.0rc1
Thanks for this. I applied the one-line fix by hand from 379 and the command now runs clean.
I first tried the 'pip install' command but it returned this error:
venv) mailman@somehost:~ $ pip install mistune==2.2.0rc1 ERROR: Could not find a version that satisfies the requirement mistune==2.2.0rc1 (from versions: 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.4, 0.4.1, 0.5, 0.5.1, 0.6, 0.7, 0 .7.1, 0.7.2, 0.7.3, 0.7.4, 0.8, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 2.0.0a1, 2.0.0a2, 2.0.0a3, 2.0.0a4, 2.0.0a5, 2.0.0a6, 2.0.0rc1, 2.0.0) ERROR: No matching distribution found for mistune==2.2.0rc1
Sorry, That's my error. It should have been
pip install mistune==2.0.0rc1
but fixing the import is probably the better way to go.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
David Newman
-
Mark Sapiro