Skip to content
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

{Packaging} Bump cryptography to 38.0.4, pyOpenSSL to 22.1.0 #24793

Merged
merged 5 commits into from
Jan 11, 2023

Conversation

benjamin-brady
Copy link
Member

@benjamin-brady benjamin-brady commented Dec 1, 2022

Close #24780.
This also fixes "Failed building wheel for cryptography" error on Mac.

Related command
Installing packages though azdev setup

Description
This change fixes a Could not build wheels for cryptography error which occurs when installing packages on an M1 Mac via azdev setup.

How to reproduce
Install prerequisites:

pip3 install azdev
git clone https://github.com/Azure/azure-cli-extensions
cd ./azure-cli-extensions

Run azdev setup, which will fail when installing azure-cli darwin packages.

azdev setup --repo ./  --cli ../azure-cli

=======================
| Azure CLI Dev Setup |
=======================

Azure CLI:
    /Users/benbrady/Documents/azure-cli

Azure CLI extension repos:
    /Users/benbrady/Documents/azure-cli-extensions-r2k1

 Installing packages 
=====================

Upgrading pip...
Installing `requirements.txt`...
Installing `azure-cli-telemetry`...
Installing `azure-cli-core`...
Installing `azure-cli`...
Installing `azure-cli-testsdk`...
Installing `requirements.py3.Darwin.txt`...
Command `/Users/benbrady/Documents/azure-cli-extensions-r2k1/env/bin/python -m pip install -r /Users/benbrady/Documents/azure-cli/src/azure-cli/requirements.py3.Darwin.txt` failed with exit code 1:

...

      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/benbrady/Documents/azure-cli-extensions-r2k1/env/include -I/Users/benbrady/.pyenv/versions/3.10.8/include/python3.10 -c build/temp.macosx-13.0-arm64-cpython-310/_openssl.c -o build/temp.macosx-13.0-arm64-cpython-310/build/temp.macosx-13.0-arm64-cpython-310/_openssl.o -Wconversion -Wno-error=sign-conversion
      build/temp.macosx-13.0-arm64-cpython-310/_openssl.c:575:10: fatal error: 'openssl/opensslv.h' file not found
      #include <openssl/opensslv.h>
               ^~~~~~~~~~~~~~~~~~~~
      1 error generated.
      
          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install cryptography:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) Read https://cryptography.io/en/latest/installation.html for specific
             instructions for your platform.
          3) Check our frequently asked questions for more information:
             https://cryptography.io/en/latest/faq.html
          =============================DEBUG ASSISTANCE=============================
      
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects

Testing Guide
On an M1 Mac run the following.

pip3 install azdev
git clone https://github.com/Azure/azure-cli-extensions
cd ./azure-cli-extensions
azdev setup --repo ./  --cli ../azure-cli

Observe darwin packaged are installed successfully with no errors.

...
Installing `requirements.py3.Darwin.txt`...

Elapsed time: 3 min 2 sec

 Finished dev setup! 
=====================

This checklist is used to make sure that common guidelines for a pull request are followed.

Issue Azure#24780 Bump cryptography and pyOpenSSL to fix "Failed building wheel for cryptography" error.
@ghost ghost requested a review from yonzhan December 1, 2022 23:30
@ghost ghost added the Auto-Assign Auto assign by bot label Dec 1, 2022
@ghost ghost requested a review from wangzelin007 December 1, 2022 23:30
@ghost ghost assigned jiasli Dec 1, 2022
@ghost ghost added this to the Dec 2022 (2023-01-03) milestone Dec 1, 2022
@ghost ghost added the Installation label Dec 1, 2022
@ghost ghost requested review from jiasli and jsntcy December 1, 2022 23:30
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 2, 2022

Misc

@yonzhan yonzhan requested a review from bebound December 2, 2022 01:01
@bebound bebound changed the title {Misc} Bump cryptography packages on Darwin {Misc} Bump pyOpenSSL to 22.1.0 Dec 2, 2022
@bebound
Copy link
Contributor

bebound commented Dec 2, 2022

Thanks for your contribution.
We use the same package on different platform, could you please also change requirements for Linux and Window?

Issue Azure#24780 - Bump cryptography and pyOpenSSL to fix "Failed building wheel for cryptography" error.
Issue Azure#24780 - Bump cryptography and pyOpenSSL to fix "Failed building wheel for cryptography" error.
@benjamin-brady
Copy link
Member Author

I've bumped the packages on all platforms. Please take a look.

@bebound bebound changed the title {Misc} Bump pyOpenSSL to 22.1.0 {Packaging} Bump pyOpenSSL to 22.1.0 Dec 6, 2022
@bebound
Copy link
Contributor

bebound commented Dec 6, 2022

@jiasli @evelyn-ys for review

jiasli
jiasli previously approved these changes Dec 7, 2022
@jiasli jiasli changed the title {Packaging} Bump pyOpenSSL to 22.1.0 {Packaging} Bump cryptography to 38.0.4, pyOpenSSL to 22.1.0 Dec 7, 2022
@jiasli jiasli requested a review from evelyn-ys December 7, 2022 03:10
bebound
bebound previously approved these changes Dec 7, 2022
@benjamin-brady
Copy link
Member Author

Please review again as I've resolved some conflicts.

evelyn-ys
evelyn-ys previously approved these changes Jan 10, 2023
@benjamin-brady
Copy link
Member Author

Please feel free to merge this as I don't have authorization.

@benjamin-brady
Copy link
Member Author

Thanks @bebound and @evelyn-ys 🙏. Could one of you please merge this on my behalf as I don't have permissions?

@jiasli
Copy link
Member

jiasli commented Jan 11, 2023

Providing some history of the cryptography dependency:

In src/azure-cli-core/setup.py, previously we set an upper bound for cryptography as 'cryptography>=3.2,<3.4' because

3.4+ versions rely on rust and cause install issues on some platforms.

See: #15687 (comment)

Later the constraint were loosened by #19639, so that community packagers can choose whichever version of cryptography they want to use.

Now as we only bump cryptography in src/azure-cli/requirements.py3.*.txt, as long as CI passes and the built package works, we can merge this PR.

Users using pip to install Azure CLI or relying setup.py should be responsible for choosing the compatible cryptography package version and tackling security vulnerabilities in older versions of cryptography.

@jiasli jiasli merged commit a35144d into Azure:dev Jan 11, 2023
@jiasli
Copy link
Member

jiasli commented Jan 11, 2023

Ops, looks like we have 39.0.0 now:

https://pypi.org/project/cryptography/

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Installation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bump cryptography and pyOpenSSL to make CLI compatible with openssl3
5 participants