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

[BUG]: ImportError on python examples #85

Closed
chamcca opened this issue Apr 20, 2023 · 7 comments
Closed

[BUG]: ImportError on python examples #85

chamcca opened this issue Apr 20, 2023 · 7 comments

Comments

@chamcca
Copy link

chamcca commented Apr 20, 2023

Python example fails to execute and unit tests fail with the error:

ImportError: cannot import name 'verify_interface' from 'cryptography.utils'

@mrinaudo-aws
Copy link
Contributor

Hello @chamcca - this issue is not directly related to this sample, but with a dependency consumed with the cloudformation-cli-python-plugin that you use as part of this sample; see this related issue instead, that already has a fix merged, but the new version of the plugin is not yet released. Looking into that fix, it does not pin cryptography to a lower version, but rather uses a new version of the aws-encryption-sdk (see the details on the merged PR). In the interim, mimicking that intent, temporarily adding aws-encryption-sdk==3.1.1 to your local copy of the requirements.txt file should suffice to package this sample correctly.

@mrinaudo-aws
Copy link
Contributor

Closing the issue and the PR accordingly, per above.

@mrinaudo-aws
Copy link
Contributor

See also this issue.

@chamcca
Copy link
Author

chamcca commented Apr 20, 2023

got it. that works, thanks for the update. i should have started there

@mrinaudo-aws
Copy link
Contributor

No worries at all! Thank you for jumping in. The updated lib (and bumped up version number) should cause the cloudformation-cli-python-lib>=2.1.3 current line in the requirements.txt on this sample to consume from the latest, to-be-released version of cloudformation-cli-python-lib, whose aws-encryption-sdk version I see it to be set to 3.1.1 as per here. With this holding true, the long-term need for forcing that dependency on a target extension (for example, this sample resource type) would not be needed, as it should be inherited by the latest, to-be-released version of that library.

@mrinaudo-aws
Copy link
Contributor

Hi @chamcca - the Python plugin and lib are now updated. I used pip to upgrade them on my machine, where I now have aws-encryption-sdk-3.1.1, cloudformation-cli-python-lib-2.1.16, and cloudformation-cli-python-plugin-2.1.8. With no changes to my requirements.txt file for the sample resource type in question (meaning, no need to add the temporary line mentioned earlier), I was able to rebuild (cfn generate && cfn submit --dry-run), and then to successfully run contract tests (13 passed, 2 skipped, 9 deselected, 1 warning in 164.10s (0:02:44), and 13 passed, 2 skipped, 9 deselected, 1 warning in 151.41s (0:02:31)). You as well should then be able to expunge the aforementioned line in your requirements.txt file, as it is now part of the "inherited" dependency; what I have now is only:

% cat requirements.txt 
cloudformation-cli-python-lib>=2.1.3

Thank you!

@chamcca
Copy link
Author

chamcca commented Apr 20, 2023

just confirmed it. works great, thanks for the update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants