I am trying to install the hashlib library for Python 3.6.0. Using pip3:
pip3 install hashlib
I get:
Collecting hashlib
Downloading hashlib-20081119.zip (42kB)
100% |████████████████████████████████| 51kB 1.6MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/__init__.py", line 10, in <module>
from setuptools.extern.six.moves import filter, filterfalse, map
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 36, in <module>
import email.parser
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/feedparser.py", line 27, in <module>
from email._policybase import compat32
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/utils.py", line 28, in <module>
import random
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/random.py", line 46, in <module>
from hashlib import sha512 as _sha512
File "/private/var/folders/3m/q2pmrqbd2l9154yp_9ww5rjm0000gn/T/pip-build-1upkmzey/hashlib/hashlib.py", line 80
raise ValueError, "unsupported hash type"
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3m/q2pmrqbd2l9154yp_9ww5rjm0000gn/T/pip-build-1upkmzey/hashlib/
Any idea on how to fix this? I am currently on macOS Sierra 10.12.6, using pip3 9.0.1 and python 3.6.
hashlibmodule is installed by default. No need to Install it, as you can see it haspython 2.*coding syntax.import hashlib. But I can’t dofrom hashlib import blake2b. I know my code is working in two other environements but I have this error just now when trying to run it on a new fresh environnement. So far I have upgrade pip withpip3 install --upgrade pip, and then, trying to install hashlib fails with the same error as OP. I remember I have to install the hashlib module from pip, because the version which comes in my distro hasn’t this algorithm… Or should I use another ? 'BLAKE2b512', 'BLAKE2s256' ?