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

Running runserver locally fails with TypeError: unhashable type: 'types.SimpleNamespace' #7924

Closed
1 task done
microamp opened this issue Sep 11, 2024 · 2 comments · Fixed by #7927
Closed
1 task done
Labels
bug Something isn't working

Comments

@microamp
Copy link
Collaborator

Describe the issue

I encountered the following error after I had rebuilt the images, containers and volumes from scratch.

ietf/manage.py runserver 8001
Performing system checks...

Traceback (most recent call last):
  File "/workspace/ietf/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/dev/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/dev/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/dev/.local/lib/python3.9/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/dev/.local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 74, in execute
    super().execute(*args, **options)
  File "/home/dev/.local/lib/python3.9/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/home/dev/.local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 111, in handle
    self.run(**options)
  File "/home/dev/.local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 118, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "/home/dev/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 671, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "/home/dev/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 660, in start_django
    reloader.run(django_main_thread)
  File "/home/dev/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 344, in run
    self.run_loop()
  File "/home/dev/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 350, in run_loop
    next(ticker)
  File "/home/dev/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 390, in tick
    for filepath, mtime in self.snapshot_files():
  File "/home/dev/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 411, in snapshot_files
    for file in self.watched_files():
  File "/home/dev/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 304, in watched_files
    yield from iter_all_python_module_files()
  File "/home/dev/.local/lib/python3.9/site-packages/django/utils/autoreload.py", line 120, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
TypeError: unhashable type: 'types.SimpleNamespace'

Performing system checks fails with TypeError: unhashable type: 'types.SimpleNamespace'

Downgrading importlib_metadata from 8.5.0 to 8.4.0 manually inside the container fixed the problem for me.

Code of Conduct

@microamp microamp added the bug Something isn't working label Sep 11, 2024
@microamp
Copy link
Collaborator Author

pipdeptree -f shows that importlib_metadata appears twice in the dependency tree.

...
django-markup==1.9
  bleach==6.1.0
    six==1.16.0
    webencodings==0.5.1
  Django==4.2.16
    asgiref==3.8.1
      typing_extensions==4.12.2
    sqlparse==0.5.1
  docutils==0.21.2
  Markdown==3.7
    importlib_metadata==8.5.0 # <---
      zipp==3.20.1
  Pygments==2.18.0
  python-creole==1.4.10
    docutils==0.21.2
  smartypants==2.0.1
  textile==4.0.2
    html5lib==1.1
      six==1.16.0
      webencodings==0.5.1
    regex==2024.9.11
...
inflect==7.4.0
  more-itertools==10.5.0
  typeguard==4.3.0
    importlib_metadata==8.5.0 # <---
      zipp==3.20.1
    typing_extensions==4.12.2
...

@jennifer-richards
Copy link
Member

We could pin the lib to 8.4.0, both of those packages that depend on it (Markdown and typeguard) are fine with at least 4.4.0.

Also, if we move to python 3.10 or higher, they won't need importlib-metadata at all if I'm reading their requirements correctly (e.g., ~/.local/lib/python3.9/site-packages/typeguard-4.3.0.dist-info/METADATA in the dev container, look for Requires-Dist: importlib-metadata)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants