Question:
One of the steps I always use to install / build my Ansible agent on target nodes was pip2 install pyOpenSSL
. This is a requirement for your Ansible client in order to use the standard Ansible module for creating self signed certificates for example openssl_certificate
Since today this no longer works.
I can reproduce this message as follows:
1 2 3 4 5 6 |
vagrant init generic/ubuntu1804 vagrant ssh sudo su - apt-get update && apt-get -y install python python-pip pip2 install pyOpenSSL |
The last step fails with message below. What is correct way to install pyOpenSSL on Ubuntu 18.04 at the moment? Is there a workaround for this problem?
Or beter, is there a Python distribution for Ansible? That includes all dependencies so I don’t have to compile build my own Ansible client?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
root@ubuntu1804:~# pip2 install pyOpenSSL Collecting pyOpenSSL Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(' Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(' Downloading https://files.pythonhosted.org/packages/01/c8/ceb170d81bd3941cbeb9940fc6cc2ef2ca4288d0ca8929ea4db5905d904d/pyOpenSSL-19.0.0-py2.py3-none-any.whl (53kB) 100% |################################| 61kB 1.0MB/s Collecting cryptography>=2.3 (from pyOpenSSL) Downloading https://files.pythonhosted.org/packages/e6/68/50698ce24c61db7d44d93a5043c621a0ca7839d4ef9dff913e6ab465fc92/cryptography-2.7-cp27-cp27mu-manylinux1_x86_64.whl (2.3MB) 100% |################################| 2.3MB 427kB/s Requirement already satisfied: six>=1.5.2 in /usr/lib/python2.7/dist-packages (from pyOpenSSL) Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python2.7/dist-packages (from cryptography>=2.3->pyOpenSSL) Requirement already satisfied: enum34; python_version < "3" in /usr/lib/python2.7/dist-packages (from cryptography>=2.3->pyOpenSSL) Requirement already satisfied: ipaddress; python_version < "3" in /usr/lib/python2.7/dist-packages (from cryptography>=2.3->pyOpenSSL) Collecting cffi!=1.11.3,>=1.8 (from cryptography>=2.3->pyOpenSSL) Downloading https://files.pythonhosted.org/packages/d6/cf/ba7e2df852a2fc807d48b3f7bea46f741830be4f047a0712e6de3e95fb6a/cffi-1.13.0.tar.gz (459kB) 100% |################################| 460kB 299kB/s Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=2.3->pyOpenSSL) Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB) 100% |################################| 163kB 280kB/s Building wheels for collected packages: cffi, pycparser Running setup.py bdist_wheel for cffi ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YCu4xd/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp_m8aI7pip-wheel- --python-tag cp27: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/cffi copying cffi/verifier.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/__init__.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/model.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/pkgconfig.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/cparser.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/api.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/ffiplatform.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/lock.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/error.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/commontypes.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/vengine_gen.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/recompiler.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/_cffi_include.h -> build/lib.linux-x86_64-2.7/cffi copying cffi/parse_c_type.h -> build/lib.linux-x86_64-2.7/cffi copying cffi/_embedding.h -> build/lib.linux-x86_64-2.7/cffi copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-2.7/cffi running build_ext building '_cffi_backend' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/c x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory #include ^~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for cffi Running setup.py clean for cffi Running setup.py bdist_wheel for pycparser ... done Stored in directory: /root/.cache/pip/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511 Successfully built pycparser Failed to build cffi Installing collected packages: pycparser, cffi, cryptography, pyOpenSSL Running setup.py install for cffi ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YCu4xd/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-FxUNAq-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/cffi copying cffi/verifier.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/__init__.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/model.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/pkgconfig.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/cparser.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/api.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/ffiplatform.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/lock.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/error.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/commontypes.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/vengine_gen.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/recompiler.py -> build/lib.linux-x86_64-2.7/cffi copying cffi/_cffi_include.h -> build/lib.linux-x86_64-2.7/cffi copying cffi/parse_c_type.h -> build/lib.linux-x86_64-2.7/cffi copying cffi/_embedding.h -> build/lib.linux-x86_64-2.7/cffi copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-2.7/cffi running build_ext building '_cffi_backend' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/c x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-PPrPZj/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory #include ^~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YCu4xd/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-FxUNAq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-YCu4xd/cffi/ root@ubuntu1804:~# |
Answer:
Install libffi-dev
to fix this issue.
1 2 |
apt install libffi-dev |