Piwheel issues with older versions of Raspbian/Hassbian

If you are using Hass.io, Docker or a distro based on Debian Buster this does not apply to you.

After upgrading to Home Assistant version 0.96.0, some users started seeing errors like this:

ImportError: /usr/lib/arm-linux-gnueabihf/libssl.so.1.1: version `OPENSSL_1_1_1' not found (required by /srv/homeassistant/lib/python3.7/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so

And all integrations that communicated with SSL (https) stopped working.

This applies if you have one of these installations with a manual installation or with Hassbian:

  • Raspbian Jessie
  • Raspbian Stretch

The reason for this, is the way piwheels determines the OS version you have by looking at the Python version that is in use.

@frenck added a writeup of the issue and potential solutions to this issue.

There are two potential solutions for this issue, where option 1 are considered the best of them.

Option 1

Upgrade your distribution to Debian Buster.

NB!: This option will upgrade your entire system and might negatively affect other things you might have running.

Before you continue with this, you should make sure that you have a recent backup of your system.

Steps

  1. Change stretch or jessie to buster in these files:
    • /etc/apt/sources.list
    • /etc/apt/sources.list.d/raspi.list
    • /etc/apt/sources.list.d/hassbian.list
  2. Run sudo apt-get update
  3. Run sudo apt-get -y dist-upgrade
  4. Run sudo reboot

Option 2

Disable piwheels prebuilt packages.

This option is a faster method initially, but it has the huge drawback of having to compile the packages locally. You should only use this option if you run other things on your system that will not work if you use the first option.

Steps

  1. edit /etc/pip.conf and comment out the line containing piwheels, like this:

    [global]
    # extra-index-url=https://www.piwheels.org/simple
    
  2. Run source /srv/homeassistant/bin/activate

  3. Run pip uninstall cryptography

  4. Run pip install --no-cache cryptography==2.7

  5. Run deactivate