Skip to content

import pgpy is failing with an error - cryptography.utils has no attribute register_interface #402

@pradeepravi87

Description

@pradeepravi87

We started facing this issue in the Databricks notebook environment, we realized this is because of cryptography library was upgraded a few hours back.

This breaks the compatibility to use the recent version of pgpy in our environment

Stack Trace -

AttributeError: module 'cryptography.utils' has no attribute 'register_interface'

AttributeError Traceback (most recent call last)
in
----> 1 import pgpy

/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/init.py in import_patch(name, globals, locals, fromlist, level)
165 # Import the desired module. If you’re seeing this while debugging a failed import,
166 # look at preceding stack frames for relevant error information.
--> 167 original_result = python_builtin_import(name, globals, locals, fromlist, level)
168
169 is_root_import = thread_local._nest_level == 1

/local_disk0/.ephemeral_nfs/envs/pythonEnv-4001c277-1e53-462b-91f8-060b1edfc8c6/lib/python3.8/site-packages/pgpy/init.py in
2 """
3
----> 4 from .pgp import PGPKey
5 from .pgp import PGPKeyring
6 from .pgp import PGPMessage

/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/init.py in import_patch(name, globals, locals, fromlist, level)
165 # Import the desired module. If you’re seeing this while debugging a failed import,
166 # look at preceding stack frames for relevant error information.
--> 167 original_result = python_builtin_import(name, globals, locals, fromlist, level)
168
169 is_root_import = thread_local._nest_level == 1

/local_disk0/.ephemeral_nfs/envs/pythonEnv-4001c277-1e53-462b-91f8-060b1edfc8c6/lib/python3.8/site-packages/pgpy/pgp.py in
25 from cryptography.hazmat.primitives import hashes
26
---> 27 from .constants import CompressionAlgorithm
28 from .constants import Features
29 from .constants import HashAlgorithm

/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/init.py in import_patch(name, globals, locals, fromlist, level)
165 # Import the desired module. If you’re seeing this while debugging a failed import,
166 # look at preceding stack frames for relevant error information.
--> 167 original_result = python_builtin_import(name, globals, locals, fromlist, level)
168
169 is_root_import = thread_local._nest_level == 1

/local_disk0/.ephemeral_nfs/envs/pythonEnv-4001c277-1e53-462b-91f8-060b1edfc8c6/lib/python3.8/site-packages/pgpy/constants.py in
21 from .decorators import classproperty
22 from .types import FlagEnum
---> 23 from ._curves import BrainpoolP256R1, BrainpoolP384R1, BrainpoolP512R1, X25519, Ed25519
24
25 all = ['Backend',

/databricks/python_shell/dbruntime/PythonPackageImportsInstrumentation/init.py in import_patch(name, globals, locals, fromlist, level)
165 # Import the desired module. If you’re seeing this while debugging a failed import,
166 # look at preceding stack frames for relevant error information.
--> 167 original_result = python_builtin_import(name, globals, locals, fromlist, level)
168
169 is_root_import = thread_local._nest_level == 1

/local_disk0/.ephemeral_nfs/envs/pythonEnv-4001c277-1e53-462b-91f8-060b1edfc8c6/lib/python3.8/site-packages/pgpy/_curves.py in
35
36
---> 37 @utils.register_interface(ec.EllipticCurve)
38 class BrainpoolP256R1(object):
39 name = 'brainpoolP256r1'

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