AttributeError: module ‘lib‘ has no attribute ‘OpenSSL_add_all_algorithms‘

The gods are silent-personal CSDN blog post directory

This problem occurred when I wanted to run conda env list, and all the error messages were:

Traceback (most recent call last):
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1132, in __call__
    return func(*args, **kwargs)
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/cli/main.py", line 57, in main_subshell
    p = generate_parser()
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 63, in generate_parser
    p = ArgumentParser(
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 148, in __init__
    self._subcommands = context.plugin_manager.get_hook_results("subcommands")
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/base/context.py", line 419, in plugin_manager
    from ..plugins.manager import get_plugin_manager
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/plugins/__init__.py", line 3, in <module>
    from .hookspec import hookimpl  # noqa: F401
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/plugins/hookspec.py", line 10, in <module>
    from .types import CondaSolver, CondaSubcommand, CondaVirtualPackage
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/plugins/types.py", line 6, in <module>
    from ..core.solve import Solver
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/core/solve.py", line 19, in <module>
    from .index import get_reduced_index, _supplement_index_with_system
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/core/index.py", line 15, in <module>
    from .package_cache_data import PackageCacheData
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/core/package_cache_data.py", line 22, in <module>
    from .path_actions import CacheUrlAction, ExtractPackageAction
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/core/path_actions.py", line 28, in <module>
    from ..gateways.connection.download import download
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/gateways/connection/download.py", line 12, in <module>
    from .session import CondaSession
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/gateways/connection/session.py", line 11, in <module>
    from .adapters.s3 import S3Adapter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/gateways/connection/adapters/s3.py", line 10, in <module>
    import boto3
  File "/home/whj/anaconda3/lib/python3.9/site-packages/boto3/__init__.py", line 17, in <module>
    from boto3.session import Session
  File "/home/whj/anaconda3/lib/python3.9/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/session.py", line 26, in <module>
    import botocore.client
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/client.py", line 15, in <module>
    from botocore import waiter, xform_name
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/client.py", line 14, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/utils.py", line 34, in <module>
    import botocore.httpsession
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/httpsession.py", line 34, in <module>
    from urllib3.contrib.pyopenssl import orig_util_SSLContext as SSLContext
  File "/home/whj/anaconda3/lib/python3.9/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.SSL
  File "/home/whj/anaconda3/lib/python3.9/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/whj/anaconda3/lib/python3.9/site-packages/OpenSSL/crypto.py", line 3279, in <module>
    _lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/whj/anaconda3/bin/conda", line 13, in <module>
    sys.exit(main())
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/cli/main.py", line 112, in main
    return conda_exception_handler(main, *args, **kwargs)
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1432, in conda_exception_handler
    return_value = exception_handler(func, *args, **kwargs)
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1135, in __call__
    return self.handle_exception(exc_val, exc_tb)
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1175, in handle_exception
    return self.handle_unexpected_exception(exc_val, exc_tb)
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1186, in handle_unexpected_exception
    self.print_unexpected_error_report(error_report)
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1248, in print_unexpected_error_report
    from .cli.main_info import get_env_vars_str, get_main_info_str
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/cli/main_info.py", line 15, in <module>
    from ..core.index import _supplement_index_with_system
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/core/index.py", line 15, in <module>
    from .package_cache_data import PackageCacheData
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/core/package_cache_data.py", line 22, in <module>
    from .path_actions import CacheUrlAction, ExtractPackageAction
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/core/path_actions.py", line 28, in <module>
    from ..gateways.connection.download import download
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/gateways/connection/download.py", line 12, in <module>
    from .session import CondaSession
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/gateways/connection/session.py", line 11, in <module>
    from .adapters.s3 import S3Adapter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/conda/gateways/connection/adapters/s3.py", line 10, in <module>
    import boto3
  File "/home/whj/anaconda3/lib/python3.9/site-packages/boto3/__init__.py", line 17, in <module>
    from boto3.session import Session
  File "/home/whj/anaconda3/lib/python3.9/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/session.py", line 26, in <module>
    import botocore.client
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/client.py", line 15, in <module>
    from botocore import waiter, xform_name
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/client.py", line 14, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/utils.py", line 34, in <module>
    import botocore.httpsession
  File "/home/whj/anaconda3/lib/python3.9/site-packages/botocore/httpsession.py", line 34, in <module>
    from urllib3.contrib.pyopenssl import orig_util_SSLContext as SSLContext
  File "/home/whj/anaconda3/lib/python3.9/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.SSL
  File "/home/whj/anaconda3/lib/python3.9/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/whj/anaconda3/lib/python3.9/site-packages/OpenSSL/crypto.py", line 3279, in <module>
    _lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

I refer to several network materials 1 , and found that the problem lies in the conflict between the cryptography package and pyopenssl, so it is recommended to run pip install --force-reinstall pyOpenSSL(in short, update pyopenssl to the latest version, and the specific command line is not unique).
But I was running that command line in an environment in the first place and that didn't work. Finally, I found that I need to conda activate basego to the base environment and then run it pip install --force-reinstall pyOpenSSL.


  1. python - Error Updating Python3 pip AttributeError: module ‘lib’ has no attribute ‘OpenSSL_add_all_algorithms’ - Stack Overflow
    amazon web services - SAM build from GitHub actions suddenly failing today: module ‘lib’ has no attribute 'OpenSSL_add_all_algorithms - Stack Overflow
    conda create environment throwing error : AttributeError: module ‘lib’ has no attribute ‘OpenSSL_add_all_algorithms’ · Issue #12234 · conda/conda ↩︎

おすすめ

転載: blog.csdn.net/PolarisRisingWar/article/details/131382718