Pio agent fails to install or run - Raspbian buster

Still weird (version 5.2.4b4) - here’s the end of the transcript:

  File "/home/jcw/.platformio/penv/lib/python3.9/site-packages/platformio/commands/remote/factory/ssl.py", line 16, in <module>
    from OpenSSL import SSL  # pylint: disable=import-error
  File "/home/jcw/.platformio/packages/contrib-pysite/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/jcw/.platformio/packages/contrib-pysite/OpenSSL/crypto.py", line 17, in <module>
    from OpenSSL._util import (
  File "/home/jcw/.platformio/packages/contrib-pysite/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/home/jcw/.platformio/packages/contrib-pysite/cryptography/hazmat/bindings/openssl/binding.py", line 170, in <module>
    _verify_package_version(cryptography.__version__)
  File "/home/jcw/.platformio/packages/contrib-pysite/cryptography/hazmat/bindings/openssl/binding.py", line 159, in _verify_package_version
    raise ImportError(
ImportError: The version of cryptography does not match the loaded shared object. This can happen if you have multiple copies of cryptography installed in your Python path. Please try creating a new virtual environment to resolve this issue. Loaded python version: 3.1.1, shared object version: b'3.3.2'

And then, surprisingly: pio remote agent start … works, repeatedly, and consistently. IOW, the build leads to an error, but the result is a working setup.

I still see cryptography 36.0 getting built twice (and taking quite some time on RasPi). Not sure this is relevant.

Update - here’s some additional info:

$ find .platformio/ -name 'cryptogra*'
.platformio/packages/contrib-pysite/cryptography
.platformio/packages/contrib-pysite/cryptography-36.0.0.dist-info
.platformio/packages/contrib-pysite/service_identity/__pycache__/cryptography.cpython-39.pyc
.platformio/packages/contrib-pysite/service_identity/cryptography.py
.platformio/packages/contrib-pysite/cryptography-3.3.2.dist-info
$