Skip to content

upgrade python pip pyopenssl/cryptography packages in ubuntu (and likely other) Codebuild images #591

@mbacchi

Description

@mbacchi

Describe the bug
Python pip packages pyOpenSSL and cryptography no longer support openssl 1.1.0 [1]. The version of both packages used in Codebuild images aws/codebuild/standard:4.0 and aws/codebuild/standard:6.0 (I did not check aws/codebuild/standard:5.0) don't seem to work unless we use the workaround described here.

This workaround entails the following:

pip install --upgrade awscli yamllint boto3 aws-sam-cli aws-lambda-builders --no-cache-dir --force-reinstall "cryptography==38.0.4"

To Reproduce
Steps to reproduce the behavior:

  1. use either image listed in description above
  2. install aws-sam-cli and awscli
  3. run aws or sam
  4. Get error AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

Expected behavior
aws and sam commands should work successfully without the workaround stated above.

Logs

[Container] 2023/01/04 20:48:11 Running command echo `aws --version`
--
200 | Traceback (most recent call last):
201 | File "/root/.pyenv/versions/3.10.5/bin/aws", line 19, in <module>
202 | import awscli.clidriver
203 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/awscli/clidriver.py", line 17, in <module>
204 | import botocore.session
205 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/session.py", line 26, in <module>
206 | import botocore.client
207 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/client.py", line 15, in <module>
208 | from botocore import waiter, xform_name
209 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/waiter.py", line 18, in <module>
210 | from botocore.docs.docstring import WaiterDocstring
211 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/docs/__init__.py", line 15, in <module>
212 | from botocore.docs.service import ServiceDocumenter
213 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/docs/service.py", line 14, in <module>
214 | from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
215 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/docs/client.py", line 14, in <module>
216 | from botocore.docs.example import ResponseExampleDocumenter
217 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/docs/example.py", line 13, in <module>
218 | from botocore.docs.shape import ShapeDocumenter
219 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/docs/shape.py", line 19, in <module>
220 | from botocore.utils import is_json_value_header
221 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/utils.py", line 37, in <module>
222 | import botocore.httpsession
223 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/botocore/httpsession.py", line 46, in <module>
224 | from urllib3.contrib.pyopenssl import (
225 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
226 | import OpenSSL.SSL
227 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/OpenSSL/__init__.py", line 8, in <module>
228 | from OpenSSL import crypto, SSL
229 | File "/root/.pyenv/versions/3.10.5/lib/python3.10/site-packages/OpenSSL/crypto.py", line 3268, in <module>
230 | _lib.OpenSSL_add_all_algorithms()
231 | AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

Platform (please complete the following information):

  • OS: Linux x86

Additional context
Happy New Year!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions