1

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

3
  • 3
    you should be able to install python for yourself (not systemwide) without privilege elevation. Commented Jan 12, 2021 at 4:19
  • Thanks for the suggestion, but I also need to use Python notebooks that are configured (by admins) to use the Python version installed on the server. Commented Jan 12, 2021 at 5:15
  • Depending on your situation, you can replace member function or subclass the relevant library based on thr new code. See this stackoverflow.com/questions/50599045/… Commented Jan 12, 2021 at 6:53

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.