Search code examples
pythonpip

Markupsafe stopping cookiecutter from installing


When trying to install cookiecutter in a virtualenv with python 3.8 I keep coming up against the following error. I get the same error when trying to install jinja2 or markupsafe directly. It seems that cookiecutter is dependent on jinja2 which is dependent on markupsafe.

      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'markupsafe'

    ----------------------------------------
  Rolling back uninstall of MarkupSafe
Command "/home/jhylands/Documents/duplicates/py/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lcltnqyr/markupsafe/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ykckm_bz-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/jhylands/Documents/duplicates/py/include/site/python3.8/markupsafe" failed with error code 1 in /tmp/pip-build-lcltnqyr/markupsafe/

Solution

  • After having tried setting the version manually of markupsafe to 1.1.1 as suggested here[1] I ended up solving (getting around) the issue by installing version 2 of markupsafe.

    It seems that jinja2 requires a minimum of version 2 and that althoough there seems to be an issue with the most up to date version of markupsafe, version 2 installs correctly.

    pip install markupsafe==2