Skip to content
Advertisement

Outdated hashlib module in a non-current version of Python

I installed a python package that I need, and tried to import it, but there’s a line of code in the package:

from hashlib import blake2s

which returned the error:

ImportError: cannot import name 'blake2s'

After a bit of reading, I found that the hashlib module in Python 3.6+ has blake2s, but I’m using Python 3.5.6. Updating my Python version would solve this problem, but I don’t have admin access on this system. So I’m stuck on Python 3.5.6.

Is there a way to get blake2s working in Python 3.5?

edit: I’m wondering if this can be used somehow… https://github.com/dchest/pyblake2

Advertisement

Answer

Answering my own question… I installed the pyblake2 package (linked in my edit above), then went inside the package I was trying to install and modified the import line.

I changed from hashlib import blake2s to from pyblake2 import blake2s and then reinstalled the package with that modified line.

It worked! The package is working in Python 3.5 even though Python 3.5 hashlib does not have blake2s.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement