Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jeremyherbert opened this issue Feb 3, 2023 · 6 comments
Closed
Labels
software Component: software upstream Meta: something we can't change ourselves

Comments

@jeremyherbert
Copy link

When running the glasgow executable for the first time after install, I get the following error:

$ glasgow
Traceback (most recent call last):
  File "/home/jeremy/.local/bin/glasgow", line 33, in <module>
    sys.exit(load_entry_point('glasgow', 'console_scripts', 'glasgow')())
  File "/home/jeremy/.local/bin/glasgow", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/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 "/home/jeremy/Downloads/glasgow/software/glasgow/cli.py", line 26, in <module>
    from .target.hardware import GlasgowHardwareTarget
  File "/home/jeremy/Downloads/glasgow/software/glasgow/target/hardware.py", line 8, in <module>
    from amaranth.build import ResourceError
  File "/home/jeremy/.local/lib/python3.10/site-packages/amaranth/build/__init__.py", line 3, in <module>
    from .plat import *
  File "/home/jeremy/.local/lib/python3.10/site-packages/amaranth/build/plat.py", line 6, in <module>
    import jinja2
  File "/home/jeremy/.local/lib/python3.10/site-packages/jinja2/__init__.py", line 12, in <module>
    from .environment import Environment
  File "/home/jeremy/.local/lib/python3.10/site-packages/jinja2/environment.py", line 25, in <module>
    from .defaults import BLOCK_END_STRING
  File "/home/jeremy/.local/lib/python3.10/site-packages/jinja2/defaults.py", line 3, in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
  File "/home/jeremy/.local/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' (/home/jeremy/.local/lib/python3.10/site-packages/markupsafe/__init__.py)

It appears that markupsafe needs to be pinned to 2.0.1 as they have removed this functionality: aws/aws-sam-cli#3661

@jeremyherbert
Copy link
Author

After running pip3 install --force-reinstall MarkupSafe==2.0.1 the glasgow command works.

@whitequark whitequark added upstream Meta: something we can't change ourselves software Component: software labels Feb 3, 2023
@whitequark
Copy link
Member

This is an upstream issue, amaranth-lang/amaranth#718.

@whitequark
Copy link
Member

I think this should be coincidentally fixed by 386a7b8 since now pip will install the git revision of Amaranth.

@daquintero
Copy link

Cheers for all the great work @whitequark ! Worth mentioning that the 386a7b8 fix for the upstream pypi installation amaranth @ git+https://github.com/amaranth-lang/amaranth.git has not been propagated to pypi as it still is pinned to the old 0.3v without this fix.

@whitequark
Copy link
Member

Worth mentioning that the 386a7b8 fix for the upstream pypi installation amaranth @ git+https://github.com/amaranth-lang/amaranth.git has not been propagated to pypi as it still is pinned to the old 0.3v without this fix.

I do not understand what you are saying here.

@attie
Copy link
Member

attie commented Aug 20, 2023

I think @daquintero is referring to amaranth on PyPi.

@daquintero, it's worth noting, that the name @ repo syntax will install the package from the git repo, and not from PyPi, so while PyPi has v0.3 listed, it'll actually be installing from the Amaranth repo directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
software Component: software upstream Meta: something we can't change ourselves
Projects
None yet
Development

No branches or pull requests

4 participants