Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django migration with python3.6 ERROR:root:code for hash sha3_224 was not found

Hello I read Django tutorials and I have an error related to specific sha3_224 hash function during the migration process. How to solve this problem? Thank you.

(venv) linuxoid@linuxoid-ThinkPad-L540:~/myprojects/myproject$ python manage.py makemigrations
ERROR:root:code for hash sha3_224 was not found.
Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 121, in __get_openssl_constructor
    f = getattr(_hashlib, 'openssl_' + name)
AttributeError: module '_hashlib' has no attribute 'openssl_sha3_224'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 243, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 128, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 113, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_224
ERROR:root:code for hash sha3_256 was not found.
Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 121, in __get_openssl_constructor
    f = getattr(_hashlib, 'openssl_' + name)
AttributeError: module '_hashlib' has no attribute 'openssl_sha3_256'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 243, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 128, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 113, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_256
ERROR:root:code for hash sha3_384 was not found.
Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 121, in __get_openssl_constructor
    f = getattr(_hashlib, 'openssl_' + name)
AttributeError: module '_hashlib' has no attribute 'openssl_sha3_384'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 243, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 128, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 113, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_384
ERROR:root:code for hash sha3_512 was not found.
Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 121, in __get_openssl_constructor
    f = getattr(_hashlib, 'openssl_' + name)
AttributeError: module '_hashlib' has no attribute 'openssl_sha3_512'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 243, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 128, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 113, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha3_512
ERROR:root:code for hash shake_128 was not found.
Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 121, in __get_openssl_constructor
    f = getattr(_hashlib, 'openssl_' + name)
AttributeError: module '_hashlib' has no attribute 'openssl_shake_128'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 243, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 128, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 113, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type shake_128
ERROR:root:code for hash shake_256 was not found.
Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 121, in __get_openssl_constructor
    f = getattr(_hashlib, 'openssl_' + name)
AttributeError: module '_hashlib' has no attribute 'openssl_shake_256'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 243, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 128, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/home/linuxoid/myprojects/venv/lib/python3.6/hashlib.py", line 113, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type shake_256
No changes detected
like image 680
Suleyman Suleymanzade Avatar asked Oct 08 '17 12:10

Suleyman Suleymanzade


3 Answers

Check if your python has been updated recently. The venv might be pointing to the old one, recreating venv fixed it for us.

Running mkvirtualenv venv or virtualenv venv (depending on how you created it in the first place) should also work while keeping the installed packages.

like image 52
Michał Łazowik Avatar answered Nov 02 '22 05:11

Michał Łazowik


!Mind it is really hot fix!

This issue appears in new version of python - 3.6.3.

Downgrade to 3.6.2 helped me

Here is legacy PPA: https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes/+index?batch=75&direction=backwards&start=75

Commands for further actions of downgrading python:

sudo apt install libpython3.6-minimal=3.6.2-1+xenial1 sudo apt install python3.6-minimal=3.6.2-1+xenial1 sudo apt install python3.6-stdlib=3.6.2-1+xenial1 sudo apt install python3.6=3.6.2-1+xenial1

like image 24
Sergey Zakharov Avatar answered Nov 02 '22 06:11

Sergey Zakharov


This solved my issue:

cd /usr/bin
sudo cp python3.6 python3

Previously I had 3.6.2, after doing apt-upgrade the system was broken.

like image 2
Emin Temiz Avatar answered Nov 02 '22 05:11

Emin Temiz