4

I was accidentally go to my miniconda directory and rm -r ca* (just because I using Arch and when update miniconda3 package, it said there are some certificates were there so it can't perform update, so I removed them)
Now every time I run conda command, it give me RuntimeError: OpenSSL 3.0's legacy provider failed to load.

here is the full log:

$conda env list

Traceback (most recent call last):
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 16, in __call__
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/cli/main.py", line 70, in main_subshell
    p = generate_parser()
        ^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/cli/conda_argparse.py", line 65, in generate_parser
    p = ArgumentParser(
        ^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/cli/conda_argparse.py", line 152, in __init__
    self._subcommands = context.plugin_manager.get_hook_results("subcommands")
                        ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/base/context.py", line 502, in plugin_manager
    from ..plugins.manager import get_plugin_manager
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/plugins/__init__.py", line 3, in <module>
    from .hookspec import hookimpl  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/plugins/hookspec.py", line 9, in <module>
    from .types import CondaSolver, CondaSubcommand, CondaVirtualPackage
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/plugins/types.py", line 7, in <module>
    from ..core.solve import Solver
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/core/solve.py", line 41, in <module>
    from .index import _supplement_index_with_system, get_reduced_index
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/core/index.py", line 24, in <module>
    from .subdir_data import SubdirData, make_feature_record
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/core/subdir_data.py", line 53, in <module>
    from ..trust.signature_verification import signature_verification
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/trust/signature_verification.py", line 12, in <module>
    from conda_content_trust.authentication import verify_delegation, verify_root
  File "/opt/miniconda3/lib/python3.11/site-packages/conda_content_trust/authentication.py", line 34, in <module>
    from .common import (
  File "/opt/miniconda3/lib/python3.11/site-packages/conda_content_trust/common.py", line 66, in <module>
    import cryptography.hazmat.backends.openssl.ed25519
  File "/opt/miniconda3/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/__init__.py", line 6, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/opt/miniconda3/lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 61, in <module>
    from cryptography.hazmat.bindings.openssl import binding
  File "/opt/miniconda3/lib/python3.11/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 232, in <module>
    Binding.init_static_locks()
  File "/opt/miniconda3/lib/python3.11/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 206, in init_static_locks
    cls._ensure_ffi_initialized()
  File "/opt/miniconda3/lib/python3.11/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 195, in _ensure_ffi_initialized
    _legacy_provider_error(cls._legacy_provider_loaded)
  File "/opt/miniconda3/lib/python3.11/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 104, in _legacy_provider_error
    raise RuntimeError(
RuntimeError: OpenSSL 3.0's legacy provider failed to load. This is a fatal error by default, but cryptography supports running without legacy algorithms by setting the environment variable CRYPTOGRAPHY_OPENSSL_NO_LEGACY. If you did not expect this error, you have likely made a mistake with your OpenSSL configuration.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/miniconda3/bin/conda", line 13, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/cli/main.py", line 129, in main
    return conda_exception_handler(main, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 376, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 19, in __call__
    return self.handle_exception(exc_val, exc_tb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 75, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 88, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 159, in print_unexpected_error_report
    from .cli.main_info import get_env_vars_str, get_main_info_str
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/cli/main_info.py", line 15, in <module>
    from ..core.index import _supplement_index_with_system
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/core/index.py", line 24, in <module>
    from .subdir_data import SubdirData, make_feature_record
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/core/subdir_data.py", line 53, in <module>
    from ..trust.signature_verification import signature_verification
  File "/opt/miniconda3/lib/python3.11/site-packages/conda/trust/signature_verification.py", line 12, in <module>
    from conda_content_trust.authentication import verify_delegation, verify_root
  File "/opt/miniconda3/lib/python3.11/site-packages/conda_content_trust/authentication.py", line 34, in <module>
    from .common import (
  File "/opt/miniconda3/lib/python3.11/site-packages/conda_content_trust/common.py", line 334, in <module>
    cryptography.hazmat.backends.openssl.ed25519._Ed25519PrivateKey, # DANGER
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'cryptography.hazmat.backends' has no attribute 'openssl'

How can I fix this?

1
  • 1
    It would preferable to file the fix as an answer. Accepting your own answer is welcome!
    – merv
    Commented Aug 23, 2023 at 14:50

1 Answer 1

8

my problem was fixed as follow:

export CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1
conda install cryptography

that's all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.