python 2.7: ERROR:root:code for hash md5 was not found

  django, python, python-2.7

I have installed python via homebrew on my macbook (macOS Big Sur 11.2.3). Yes, I know, it’s outdated, but I need it for some old projects.

I use virtualenv to seperate stuff.

When I try to run ./manage.py runserver I got this error:

ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/[email protected]/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/[email protected]/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
.
.
.
File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/Cellar/[email protected]/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 8, in <module>
    from django.contrib.auth.hashers import (
  File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/contrib/auth/hashers.py", line 241, in <module>
    class PBKDF2PasswordHasher(BasePasswordHasher):
  File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/contrib/auth/hashers.py", line 251, in PBKDF2PasswordHasher
    digest = hashlib.sha256
AttributeError: 'module' object has no attribute 'sha256'

Maybe it is a problem with hashlib or openssl?
Thanks.

Source: Python Questions

LEAVE A COMMENT