Skip to content

Cannot import name 'soft_unicode' from 'markupsafe #84

@aless80

Description

@aless80

After a new install (also notice an unrelated error with wheel on my fresh install):

Collecting cvcreator
  Using cached cvcreator-1.1.3-py3-none-any.whl (216 kB)
Collecting toml<0.11.0,>=0.10.2
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting PyYAML<6.0.0,>=5.4.1
  Using cached PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl (662 kB)
Collecting pydantic<2.0.0,>=1.8.1
  Using cached pydantic-1.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.6 MB)
Collecting Jinja2<3.0.0,>=2.11.3
  Using cached Jinja2-2.11.3-py2.py3-none-any.whl (125 kB)
Collecting pycountry<21.0.0,>=20.7.3
  Using cached pycountry-20.7.3.tar.gz (10.1 MB)
Collecting click<9.0.0,>=8.0.1
  Using cached click-8.0.4-py3-none-any.whl (97 kB)
Collecting click-help-colors<0.10,>=0.9
  Using cached click_help_colors-0.9.1-py3-none-any.whl (5.5 kB)
Collecting typing-extensions>=3.7.4.3
  Using cached typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Collecting MarkupSafe>=0.23
  Using cached MarkupSafe-2.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Building wheels for collected packages: pycountry
  Building wheel for pycountry (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/amarin/xal/cvcreator/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r7be6k1r/pycountry/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r7be6k1r/pycountry/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-t8q0c9id
       cwd: /tmp/pip-install-r7be6k1r/pycountry/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for pycountry
  Running setup.py clean for pycountry
Failed to build pycountry
Installing collected packages: toml, PyYAML, typing-extensions, pydantic, MarkupSafe, Jinja2, pycountry, click, click-help-colors, cvcreator
    Running setup.py install for pycountry ... done
Successfully installed Jinja2-2.11.3 MarkupSafe-2.1.0 PyYAML-5.4.1 click-8.0.4 click-help-colors-0.9.1 cvcreator-1.1.3 pycountry-20.7.3 pydantic-1.9.0 toml-0.10.2 typing-extensions-4.1.1

cv create does not work:

(venv) cv create AlessandroMarin.toml
Traceback (most recent call last):
  File "/home/amarin/xal/cvcreator/venv/bin/cv", line 5, in <module>
    from cvcreator.parser import cv
  File "/home/amarin/xal/cvcreator/venv/lib/python3.8/site-packages/cvcreator/parser.py", line 13, in <module>
    from .template import load_template
  File "/home/amarin/xal/cvcreator/venv/lib/python3.8/site-packages/cvcreator/template.py", line 5, in <module>
    from jinja2 import Template
  File "/home/amarin/xal/cvcreator/venv/lib/python3.8/site-packages/jinja2/__init__.py", line 12, in <module>
    from .environment import Environment
  File "/home/amarin/xal/cvcreator/venv/lib/python3.8/site-packages/jinja2/environment.py", line 25, in <module>
    from .defaults import BLOCK_END_STRING
  File "/home/amarin/xal/cvcreator/venv/lib/python3.8/site-packages/jinja2/defaults.py", line 3, in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
  File "/home/amarin/xal/cvcreator/venv/lib/python3.8/site-packages/jinja2/filters.py", line 13, in <module>
    from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/home/amarin/xal/cvcreator/venv/lib/python3.8/site-packages/markupsafe/__init__.py)

By downgrading Jinja2 and overlooking a warning from cvcreator, cv create works again

(venv) pip freeze | grep Jin
Jinja2==2.11.3

(venv) pip uninstall Jinja2
(venv) pip install Jinja2<2.1.0
Collecting Jinja2
  Using cached Jinja2-3.0.3-py3-none-any.whl (133 kB)
Requirement already satisfied: MarkupSafe>=2.0 in ./venv/lib/python3.8/site-packages (from Jinja2) (2.1.0)
ERROR: cvcreator 1.1.3 has requirement Jinja2<3.0.0,>=2.11.3, but you'll have jinja2 3.0.3 which is incompatible.
Installing collected packages: Jinja2
Successfully installed Jinja2-3.0.3

Maybe this helps: pallets/jinja#1585

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions