fastai / fastdoc

Create publication-quality books from Jupyter notebooks
https://fastai.github.io/fastdoc/
Apache License 2.0
232 stars 30 forks source link

ImportError: cannot import name 'soft_unicode' from 'markupsafe' #39

Open ghost opened 2 years ago

ghost commented 2 years ago

It seems like an upstream dependency has changed such that a fresh pip install fastdoc no longer converts off the bat as expected:

% fastdoc_convert_all --path notebooks --dest_path asciidoc

Traceback (most recent call last):
  File "/Users/usr/.virtualenvs/pdsh2e/bin/fastdoc_convert_all", line 5, in <module>
    from fastdoc.asciidoc import fastdoc_convert_all
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/fastdoc/asciidoc.py", line 14, in <module>
    from .imports import *
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/fastdoc/imports.py", line 2, in <module>
    import os.path, re, nbformat, jupyter_contrib_nbextensions, glob, shutil
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/jupyter_contrib_nbextensions/__init__.py", line 5, in <module>
    import jupyter_nbextensions_configurator
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/jupyter_nbextensions_configurator/__init__.py", line 18, in <module>
    from notebook.base.handlers import APIHandler, IPythonHandler
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/notebook/base/handlers.py", line 21, in <module>
    from jinja2 import TemplateNotFound
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/jinja2/__init__.py", line 12, in <module>
    from .environment import Environment
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/jinja2/environment.py", line 25, in <module>
    from .defaults import BLOCK_END_STRING
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/jinja2/defaults.py", line 3, in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
  File "/Users/usr/.virtualenvs/pdsh2e/lib/python3.10/site-packages/jinja2/filters.py", line 13, in <module>
    from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe'

Fix seems to be to pin markupsafe to an older version (e.g., markupsafe==2.0.1), but it would probably be good to fix the import.