{"id":997,"date":"2022-09-07T22:45:33","date_gmt":"2022-09-08T02:45:33","guid":{"rendered":"https:\/\/jasonralph.org\/?p=997"},"modified":"2022-09-08T00:22:36","modified_gmt":"2022-09-08T04:22:36","slug":"attributeerror-module-cryptography-utils-has-no-attribute-register_interface","status":"publish","type":"post","link":"https:\/\/jasonralph.org\/?p=997","title":{"rendered":"AttributeError: module &#8216;cryptography.utils&#8217; has no attribute &#8216;register_interface&#8217;"},"content":{"rendered":"<p>I just recently came across an issue when we were bootstrapping one of our EMR clusters, looks like when trying to import pgpy we failed with the following traceback:<\/p>\n<pre class=\"theme:solarized-dark lang:default decode:true \" >\r\nTraceback (most recent call last):\r\n  File \"\/mnt\/var\/lib\/hadoop\/steps\/s-B2LJDDVVD5Y1\/.\/aws_s3_decrypt.py\", line 18, in <module>\r\n    import pgpy\r\n  File \"\/usr\/local\/lib\/python3.7\/site-packages\/pgpy\/__init__.py\", line 4, in <module>\r\n    from .pgp import PGPKey\r\n  File \"\/usr\/local\/lib\/python3.7\/site-packages\/pgpy\/pgp.py\", line 27, in <module>\r\n    from .constants import CompressionAlgorithm\r\n  File \"\/usr\/local\/lib\/python3.7\/site-packages\/pgpy\/constants.py\", line 23, in <module>\r\n    from ._curves import BrainpoolP256R1, BrainpoolP384R1, BrainpoolP512R1, X25519, Ed25519\r\n  File \"\/usr\/local\/lib\/python3.7\/site-packages\/pgpy\/_curves.py\", line 37, in <module>\r\n    @utils.register_interface(ec.EllipticCurve)\r\nAttributeError: module 'cryptography.utils' has no attribute 'register_interface'\r\nCommand exiting with ret '1'\r\n<\/pre>\n<p>Apparently the cryptography team released a new version on September 7th 2022 that broke the pgpy library.<br \/>\n<a href=\"https:\/\/pypi.org\/project\/cryptography\/38.0.1\/\">https:\/\/pypi.org\/project\/cryptography\/38.0.1\/<\/a><\/p>\n<p>We needed to downgrade our version to get things working again.  I figured I would post this to see if others run into this, according to the pgpy github page, they are working on a fix.<\/p>\n<p><a href=\"https:\/\/github.com\/SecurityInnovation\/PGPy\/issues\/402\">https:\/\/github.com\/SecurityInnovation\/PGPy\/issues\/402<\/a><\/p>\n<p>Here is how I solved it in the meantime, I needed to downgrade the cryptography library. <\/p>\n<pre class=\"theme:solarized-dark lang:default decode:true \" >\r\nsudo python3 -m pip install PGPy\r\nsudo python3 -m pip uninstall -y cryptography\r\nsudo python3 -m pip install cryptography==37.0.4\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I just recently came across an issue when we were bootstrapping one of our EMR clusters, looks like when trying to import pgpy we failed with the following traceback: Traceback (most recent call last): File &#8220;\/mnt\/var\/lib\/hadoop\/steps\/s-B2LJDDVVD5Y1\/.\/aws_s3_decrypt.py&#8221;, line 18, in import pgpy File &#8220;\/usr\/local\/lib\/python3.7\/site-packages\/pgpy\/__init__.py&#8221;, line 4, in from .pgp import PGPKey File &#8220;\/usr\/local\/lib\/python3.7\/site-packages\/pgpy\/pgp.py&#8221;, line 27, in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4],"tags":[116,117,101,115,118],"class_list":["post-997","post","type-post","status-publish","format-standard","hentry","category-general-code","category-python","tag-cryptography","tag-cryptography-utils","tag-emr","tag-pgpy","tag-register_interface"],"_links":{"self":[{"href":"https:\/\/jasonralph.org\/index.php?rest_route=\/wp\/v2\/posts\/997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jasonralph.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jasonralph.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jasonralph.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jasonralph.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=997"}],"version-history":[{"count":6,"href":"https:\/\/jasonralph.org\/index.php?rest_route=\/wp\/v2\/posts\/997\/revisions"}],"predecessor-version":[{"id":1003,"href":"https:\/\/jasonralph.org\/index.php?rest_route=\/wp\/v2\/posts\/997\/revisions\/1003"}],"wp:attachment":[{"href":"https:\/\/jasonralph.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jasonralph.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jasonralph.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}