core icon indicating copy to clipboard operation
core copied to clipboard

All HTTP requests fail due to "AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'"

Open andersonshatch opened this issue 2 years ago • 2 comments

The problem

In 2023.2.x all HTTP requests fail due to this error:

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

I can workaround this by reverting to 2023.1.x or with 2023.2.x by running pip install cryptography==38.0.4

What version of Home Assistant Core has the issue?

2023.2.4

What was the last working version of Home Assistant Core?

2023.1.7

What type of installation are you running?

Home Assistant Core

Integration causing the issue

http

Link to integration documentation on our website

https://www.home-assistant.io/integrations/http/

Diagnostics information

No response

Example YAML snippet

http:
  use_x_forwarded_for: true 
  trusted_proxies:
    - 127.0.0.1
    - 192.168.0.117

Anything in the logs that might be useful for us?

2023-02-14 20:26:34.473 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/Users/josh/.pyenv/versions/3.10.9/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/Users/josh/.pyenv/versions/3.10.9/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/Users/josh/.pyenv/versions/3.10.9/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/Users/josh/.pyenv/versions/3.10.9/lib/python3.10/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/Users/josh/.pyenv/versions/3.10.9/lib/python3.10/site-packages/homeassistant/components/http/forwarded.py", line 82, in forwarded_middleware
    from hass_nabucasa import (  # pylint: disable=import-outside-toplevel
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/hass_nabucasa/__init__.py", line 15, in <module>
    from .auth import CloudError, CognitoAuth
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/hass_nabucasa/auth.py", line 11, in <module>
    import boto3
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/boto3/__init__.py", line 16, in <module>
    from boto3.session import Session
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/botocore/session.py", line 30, in <module>
    import botocore.credentials
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/botocore/credentials.py", line 34, in <module>
    from botocore.config import Config
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/botocore/config.py", line 16, in <module>
    from botocore.endpoint import DEFAULT_TIMEOUT, MAX_POOL_CONNECTIONS
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/botocore/endpoint.py", line 22, in <module>
    from botocore.awsrequest import create_request_object
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/botocore/awsrequest.py", line 26, in <module>
    import botocore.utils
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/botocore/utils.py", line 33, in <module>
    import botocore.httpsession
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/botocore/httpsession.py", line 19, in <module>
    from urllib3.contrib.pyopenssl import orig_util_SSLContext as SSLContext
  File "/Users/josh/.pyenv/versions/3.10.9/lib/python3.10/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.crypto
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/OpenSSL/__init__.py", line 8, in <module> 
    from OpenSSL import crypto, SSL
  File "/Users/josh/.homeassistant/deps/lib/python3.10/site-packages/OpenSSL/crypto.py", line 3279, in <module>
    _lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

Additional information

Python version 3.10.9 from pyenv macOS 13.2

andersonshatch avatar Feb 14 '23 20:02 andersonshatch

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (http) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of http can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign http Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


http documentation http source (message by IssueLinks)

home-assistant[bot] avatar Feb 14 '23 20:02 home-assistant[bot]

Up? I'm getting this on ArchLinuxARM as well. Version is 2023.2.3.

EDIT: Ideally, this should have been fixed by #85846 :thinking:

ilpianista avatar Feb 27 '23 10:02 ilpianista

FYI I've solved it by removing the deps folder and restarting HASS.

ilpianista avatar Mar 06 '23 07:03 ilpianista

I tried removing dep then reinstalling homeassistant from pip, but still the same error. I noticed that installing cryptography from pip gets me version 39.0.2, but installing homeasistant on pip downgrades it back downto cryptography-39.0.1

Br3nda avatar Mar 09 '23 20:03 Br3nda

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.