-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot import hashlib when openssl is missing #80725
Comments
Python is built natively in a docker container (based on ubuntu bionic) that lacks openssl. pydev@979e9e009b08:~/build/python-native$ ./python
Python 3.8.0a3+ (heads/master-dirty:d6bf6f2, Apr 6 2019, 14:43:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, 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 "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
File "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
File "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
File "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
File "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
ERROR:root:code for hash blake2b was not found.
Traceback (most recent call last):
File "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2b
ERROR:root:code for hash blake2s was not found.
Traceback (most recent call last):
File "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2s
ERROR:root:code for hash sha3_224 was not found.
Traceback (most recent call last):
File "/home/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/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/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/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/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/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/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/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/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/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/pydev/cpython/Lib/hashlib.py", line 244, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/home/pydev/cpython/Lib/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type shake_256
>>> |
Changeset 5ec33a1 appends to the new detect_openssl_hashlib() method, the detection for the _sha256, _sha512, _md5, ... extension modules. These modules were detected unconditionnaly before this change and are not detected anymore now when openssl is not supported by the platform. |
Working on a PR |
Steps to reproduce (requires docker support, about 500 MB and only few minutes):
#################################### RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ # Run as user 'pydev'.
$ docker build --tag=ubuntu:bpo-36544 .
$ docker run -it ubuntu:bpo-36544
|
Check that PR 12708 fixes the bug: Run the ubuntu:bpo-36544 image and enters bash as user pydev $ docker run -it ubuntu:bpo-36544
|
Xavier de Gaye: Oops! I also saw such errors but I didn't understand them. Thanks for the fix! I wrote PR 12750 to fix another minor issue which isn't directly related to your fix (nor to my previous refactoring). |
Thanks Victor for the refactoring of setup.py. That was badly needed indeed. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: