Cannot import name '_get_backend'

Hi all this morning I run pio remote agent start

pi@test:~ $ pio remote agent start
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting twisted==20.3.0
  Using cached https://files.pythonhosted.org/packages/4a/b4/4973c7ccb5be2ec0abc779b7d5f9d5f24b17b0349e23240cfc9dc3bd83cc/Twisted-20.3.0.tar.bz2
Collecting Automat>=0.3.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/80/c5/82c63bad570f4ef745cc5c2f0713c8eddcd07153b4bee7f72a8dc9f9384b/Automat-20.2.0.tar.gz
Collecting PyHamcrest!=1.10.0,>=1.9.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/58/05/7b993fabb44ff0b52a90916d96bfd91a65ecf90b8248e72bba325ba8e438/PyHamcrest-2.0.2.tar.gz
Collecting attrs>=19.2.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting constantly>=15.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/95/f1/207a0a478c4bb34b1b49d5915e2db574cadc415c9ac3a7ef17e29b2e8951/constantly-15.1.0.tar.gz
Collecting hyperlink>=17.1.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/b7/bf/ecacc60e63d65f7449457bbd8163141c51c4af7aeff7958ec061b8faf915/hyperlink-20.0.1.tar.gz
  Installing build dependencies ... done
Collecting incremental>=16.10.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/8f/26/02c4016aa95f45479eea37c90c34f8fab6775732ae62587a874b619ca097/incremental-17.5.0.tar.gz
Collecting zope.interface>=4.4.2 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/84/21/80cdc749908ebf2719a9063eddcc02b668fbc62d200c1f1a4d92aaaba76b/zope.interface-5.2.0.tar.gz
Collecting six (from Automat>=0.3.0->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting idna>=2.5 (from hyperlink>=17.1.1->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Collecting setuptools (from zope.interface>=4.4.2->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/a7/e0/30642b9c2df516506d40b563b0cbd080c49c6b3f11a70b4c7a670f13a78b/setuptools-50.3.2.zip
Skipping bdist_wheel for twisted, due to binaries being disabled for it.
Skipping bdist_wheel for Automat, due to binaries being disabled for it.
Skipping bdist_wheel for PyHamcrest, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for constantly, due to binaries being disabled for it.
Skipping bdist_wheel for hyperlink, due to binaries being disabled for it.
Skipping bdist_wheel for incremental, due to binaries being disabled for it.
Skipping bdist_wheel for zope.interface, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Skipping bdist_wheel for setuptools, due to binaries being disabled for it.
Installing collected packages: attrs, six, Automat, PyHamcrest, constantly, idna, hyperlink, incremental, setuptools, zope.interface, twisted
  Running setup.py install for attrs ... done
  Running setup.py install for six ... done
  Running setup.py install for Automat ... done
  Running setup.py install for PyHamcrest ... done
  Running setup.py install for constantly ... done
  Running setup.py install for idna ... done
  Running setup.py install for hyperlink ... done
  Running setup.py install for incremental ... done
  Running setup.py install for setuptools ... done
  Running setup.py install for zope.interface ... done
  Running setup.py install for twisted ... done
Successfully installed Automat-20.2.0 PyHamcrest-2.0.2 attrs-20.3.0 constantly-15.1.0 hyperlink-20.0.1 idna-2.10 incremental-17.5.0 setuptools-50.3.2 six-1.15.0 twisted-20.3.0 zope.interface-5.2.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting autobahn==20.7.1
  Using cached https://files.pythonhosted.org/packages/f2/f2/3408aefd435b5e0a4f4f36022401d6c86ff1abe85af1d308cd6d07073e72/autobahn-20.7.1.tar.gz
Collecting cryptography>=2.7 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting txaio>=20.3.1 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/e7/dd/c0c90b080c3fad0ac8e2382eddbe86591d4fa1a5c1aea652de0adf245fc0/txaio-20.4.1.tar.gz
Collecting six>=1.4.1 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for autobahn, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for txaio, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, txaio, autobahn
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for txaio ... done
  Running setup.py install for autobahn ... done
Successfully installed autobahn-20.7.1 cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 six-1.15.0 txaio-20.4.1
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/twisted already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/bin already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting json-rpc==1.13.0
  Using cached https://files.pythonhosted.org/packages/43/5a/7c2ea59e622682fff34d5aa3b301aa9a10bb0dbf0120f85cd391e4badad8/json-rpc-1.13.0.tar.gz
Skipping bdist_wheel for json-rpc, due to binaries being disabled for it.
Installing collected packages: json-rpc
  Running setup.py install for json-rpc ... done
Successfully installed json-rpc-1.13.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyopenssl>=16.0.0
  Downloading https://files.pythonhosted.org/packages/09/67/38a1080fabbb908515c47694238e00b6a73a82d9dbc76372263a231abfcb/pyOpenSSL-20.0.0.tar.gz (173kB)
    100% |████████████████████████████████| 174kB 1.3MB/s
  Installing build dependencies ... done
Collecting cryptography>=3.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.5.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for pyopenssl, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, pyopenssl
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... /done
  Running setup.py install for pyopenssl ... done
Successfully installed cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 pyopenssl-20.0.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting service_identity>=18.1.0
  Using cached https://files.pythonhosted.org/packages/9a/3d/9eb0563e066ea0540cf580695593ab079376e920016d4d1b3ff2fd8abf4b/service_identity-18.1.0.tar.gz
  Installing build dependencies ... done
Collecting attrs>=16.0.0 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... /

done
Collecting pyasn1-modules (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/88/87/72eb9ccf8a58021c542de2588a867dbefc7556e14b2866d1e40e9e2b587e/pyasn1-modules-0.2.8.tar.gz
Collecting pyasn1 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/a4/db/fffec68299e6d7bad3d504147f9094830b704527a7fc098b721d38cc7fa7/pyasn1-0.4.8.tar.gz
Collecting cryptography (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.4.1 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for service-identity, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1-modules, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: attrs, pyasn1, pyasn1-modules, six, pycparser, cffi, cryptography, service-identity
  Running setup.py install for attrs ... done
  Running setup.py install for pyasn1 ... done
  Running setup.py install for pyasn1-modules ... done
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for service-identity ... done
Successfully installed attrs-20.3.0 cffi-1.14.4 cryptography-3.2.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.20 service-identity-18.1.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/attr already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/attrs-20.3.0-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting idna!=2.3,>=0.6
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Installing collected packages: idna
  Running setup.py install for idna ... done
Successfully installed idna-2.10
Target directory /home/pi/.platformio/packages/contrib-pysite/idna already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/idna-2.10.egg-info already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting zeroconf==0.26.0
  Using cached https://files.pythonhosted.org/packages/d1/fc/adab674bf986b6db84fc976ee4921460eb9c9334c8c475abcc55169e8711/zeroconf-0.26.0.tar.gz
  Installing build dependencies ... done
Collecting ifaddr (from zeroconf==0.26.0)
  Using cached https://files.pythonhosted.org/packages/3d/fc/4ce147e3997cd0ea470ad27112087545cf83bf85015ddb3054673cb471bb/ifaddr-0.1.7.tar.gz
Skipping bdist_wheel for zeroconf, due to binaries being disabled for it.
Skipping bdist_wheel for ifaddr, due to binaries being disabled for it.
Installing collected packages: ifaddr, zeroconf
  Running setup.py install for ifaddr ... done
  Running setup.py install for zeroconf ... done
Successfully installed ifaddr-0.1.7 zeroconf-0.26.0
Error: Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/command.py", line 60, in remote_agent_start
    from platformio.commands.remote.client.agent_service import RemoteAgentService
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/client/agent_service.py", line 25, in <module>
    from platformio.commands.remote.client.base import RemoteClientBase
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/client/base.py", line 30, in <module>
    from platformio.commands.remote.factory.ssl import SSLContextFactory
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/factory/ssl.py", line 16, in <module>
    from OpenSSL import SSL  # pylint: disable=import-error
  File "/home/pi/.platformio/packages/contrib-pysite/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/pi/.platformio/packages/contrib-pysite/OpenSSL/crypto.py", line 14, in <module>
    from cryptography import utils, x509
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/base.py", line 15, in <module>
    from cryptography.hazmat.backends import _get_backend
ImportError: cannot import name '_get_backend' from 'cryptography.hazmat.backends' (/home/pi/.platformio/packages/contrib-pysite/cryptography/hazmat/backends/__init__.py)

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

This is my info

--------------------------  --------------------------------------
PlatformIO Core             5.0.4a2
Python                      3.7.3-final.0
System Type                 linux_armv7l
Platform                    Linux-5.4.72-v7+-armv7l-with-glibc2.28
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core Directory   /home/pi/.platformio
PlatformIO Core Executable  /home/pi/.local/bin/platformio
Python Executable           /usr/bin/python3
Global Libraries            0
Development Platforms       3
Tools & Toolchains          14
--------------------------  --------------------------------------

Did you have I idea how to fix it?

Seems to me you just didn’t do sudo apt install libffi-dev libssl-dev to get the SSL library dependencies? Without that the Python cryptography library won’t work…

Check the topic at HowTo: Raspberry Pi 3 as remote agent (Oct. 2020).

Looks they were installed:

pi@test:~ $ sudo apt install libffi-dev libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libffi-dev is already the newest version (3.2.1-9).
libssl-dev is already the newest version (1.1.1d-0+deb10u3+rpt1).
The following packages were automatically installed and are no longer required:
  libbdplus0 libssh-gcrypt-4 libtwolame0 libva-drm2 libvpx5 libwavpack1 libx264-155 libx265-165 rpi-eeprom-images
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Sometime, when I run the agent, an update starts. If it fails, and I re-run again, no update are executed and the agent runs correctly. Is not clear to me why.
In any case today i runned pio update, getting

pi@test:~ $ platformio upgrade
Please wait while upgrading PlatformIO ...

PlatformIO has been successfully upgraded to 5.0.4b1
Release notes: https://docs.platformio.org/en/latest/history.html
pi@test:~ $
pi@test:~ $ pio update
Please wait while upgrading PlatformIO...
PlatformIO has been successfully upgraded to 5.0.4b1!

************************************************************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for embedded development > https://platformio.org/platformio-ide
************************************************************************************************************************

Updating platformio/contrib-piohome           3.3.1 @ ~3.3.1                     [Up-to-date]
Updating platformio/contrib-pysite            2.37.191020 @ ~2.37.0              [Incompatible 2.39.201020]
Updating platformio/tool-scons                4.40001.0 @ ~4.40001.0             [Up-to-date]

Platform Manager
================
Platform atmelavr
--------
Updating platformio/atmelavr                  3.0.0                              [Up-to-date]
Updating platformio/framework-arduino-avr     5.1.0 @ ~5.1.0                     [Up-to-date]
Updating platformio/tool-avrdude              1.60300.200527 @ ~1.60300.0        [Up-to-date]

Platform espressif32
--------
Updating platformio/espressif32               2.0.0                              [Outdated 2.1.0]
Platform Manager: Installing platformio/espressif32 @ 2.1.0
Unpacking  [####################################]  100%
Platform Manager: espressif32 @ 2.1.0 has been installed!
Tool Manager: Installing platformio/toolchain-xtensa32 @ ~2.50200.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: toolchain-xtensa32 @ 2.50200.80 has been installed!
Tool Manager: Installing platformio/tool-esptoolpy @ ~1.30000.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: tool-esptoolpy @ 1.30000.201119 has been installed!
Platform Manager: Removing espressif32 @ 2.0.0
Platform Manager: espressif32 @ 2.0.0 has been removed!
Updating platformio/toolchain-xtensa32        2.50200.80 @ ~2.50200.0            [Up-to-date]
Updating platformio/framework-arduinoespressif32 3.10004.201016 @ ~3.10004.191002   [Up-to-date]
Updating platformio/tool-esptoolpy            1.30000.201119 @ ~1.30000.0        [Up-to-date]
Updating platformio/tool-mkspiffs             2.230.0 @ ~2.230.0                 [Up-to-date]
Tool Manager: Removing tool-esptoolpy @ 1.30000.201119
Tool Manager: tool-esptoolpy @ 1.30000.201119 has been removed!

Platform espressif8266
--------
Updating platformio/espressif8266             2.6.2                              [Up-to-date]
Updating platformio/toolchain-xtensa          2.40802.200502 @ ~2.40802.191122   [Up-to-date]
Updating platformio/framework-arduinoespressif8266 3.20704.0 @ ~3.20704.0             [Up-to-date]
Updating platformio/tool-esptool              1.413.0 @ <2                       [Up-to-date]
Updating platformio/tool-esptoolpy            1.20800.0 @ ~1.20800.0             [Up-to-date]
Updating platformio/tool-mkspiffs             1.200.0 @ ~1.200.0                 [Up-to-date]
Updating platformio/tool-mklittlefs           1.203.200522 @ ~1.203.0            [Up-to-date]
Tool Manager: Removing tool-esptoolpy @ 1.20800.0
Tool Manager: tool-esptoolpy @ 1.20800.0 has been removed!


Library Manager
===============
Library Storage: /home/pi/.platformio/lib

When I run again

pio remote agent start

I got

pi@test:~ $ pio remote agent start
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting twisted==20.3.0
  Using cached https://files.pythonhosted.org/packages/4a/b4/4973c7ccb5be2ec0abc779b7d5f9d5f24b17b0349e23240cfc9dc3bd83cc/Twisted-20.3.0.tar.bz2
Collecting Automat>=0.3.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/80/c5/82c63bad570f4ef745cc5c2f0713c8eddcd07153b4bee7f72a8dc9f9384b/Automat-20.2.0.tar.gz
Collecting PyHamcrest!=1.10.0,>=1.9.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/58/05/7b993fabb44ff0b52a90916d96bfd91a65ecf90b8248e72bba325ba8e438/PyHamcrest-2.0.2.tar.gz
Collecting attrs>=19.2.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting constantly>=15.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/95/f1/207a0a478c4bb34b1b49d5915e2db574cadc415c9ac3a7ef17e29b2e8951/constantly-15.1.0.tar.gz
Collecting hyperlink>=17.1.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/b7/bf/ecacc60e63d65f7449457bbd8163141c51c4af7aeff7958ec061b8faf915/hyperlink-20.0.1.tar.gz
  Installing build dependencies ... done
Collecting incremental>=16.10.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/8f/26/02c4016aa95f45479eea37c90c34f8fab6775732ae62587a874b619ca097/incremental-17.5.0.tar.gz
Collecting zope.interface>=4.4.2 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/84/21/80cdc749908ebf2719a9063eddcc02b668fbc62d200c1f1a4d92aaaba76b/zope.interface-5.2.0.tar.gz
Collecting six (from Automat>=0.3.0->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting idna>=2.5 (from hyperlink>=17.1.1->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Collecting setuptools (from zope.interface>=4.4.2->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/a7/e0/30642b9c2df516506d40b563b0cbd080c49c6b3f11a70b4c7a670f13a78b/setuptools-50.3.2.zip
Skipping bdist_wheel for twisted, due to binaries being disabled for it.
Skipping bdist_wheel for Automat, due to binaries being disabled for it.
Skipping bdist_wheel for PyHamcrest, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for constantly, due to binaries being disabled for it.
Skipping bdist_wheel for hyperlink, due to binaries being disabled for it.
Skipping bdist_wheel for incremental, due to binaries being disabled for it.
Skipping bdist_wheel for zope.interface, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Skipping bdist_wheel for setuptools, due to binaries being disabled for it.
Installing collected packages: attrs, six, Automat, PyHamcrest, constantly, idna, hyperlink, incremental, setuptools, zope.interface, twisted
  Running setup.py install for attrs ... done
  Running setup.py install for six ... done
  Running setup.py install for Automat ... done
  Running setup.py install for PyHamcrest ... done
  Running setup.py install for constantly ... done
  Running setup.py install for idna ... done
  Running setup.py install for hyperlink ... done
  Running setup.py install for incremental ... done
  Running setup.py install for setuptools ... done
  Running setup.py install for zope.interface ... done
  Running setup.py install for twisted ... done
Successfully installed Automat-20.2.0 PyHamcrest-2.0.2 attrs-20.3.0 constantly-15.1.0 hyperlink-20.0.1 idna-2.10 incremental-17.5.0 setuptools-50.3.2 six-1.15.0 twisted-20.3.0 zope.interface-5.2.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting autobahn==20.7.1
  Using cached https://files.pythonhosted.org/packages/f2/f2/3408aefd435b5e0a4f4f36022401d6c86ff1abe85af1d308cd6d07073e72/autobahn-20.7.1.tar.gz
Collecting cryptography>=2.7 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting txaio>=20.3.1 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/e7/dd/c0c90b080c3fad0ac8e2382eddbe86591d4fa1a5c1aea652de0adf245fc0/txaio-20.4.1.tar.gz
Collecting six>=1.4.1 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for autobahn, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for txaio, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, txaio, autobahn
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for txaio ... done
  Running setup.py install for autobahn ... done
Successfully installed autobahn-20.7.1 cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 six-1.15.0 txaio-20.4.1
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/twisted already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/bin already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting json-rpc==1.13.0
  Using cached https://files.pythonhosted.org/packages/43/5a/7c2ea59e622682fff34d5aa3b301aa9a10bb0dbf0120f85cd391e4badad8/json-rpc-1.13.0.tar.gz
Skipping bdist_wheel for json-rpc, due to binaries being disabled for it.
Installing collected packages: json-rpc
  Running setup.py install for json-rpc ... done
Successfully installed json-rpc-1.13.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyopenssl>=16.0.0
  Using cached https://files.pythonhosted.org/packages/09/67/38a1080fabbb908515c47694238e00b6a73a82d9dbc76372263a231abfcb/pyOpenSSL-20.0.0.tar.gz
  Installing build dependencies ... done
Collecting cryptography>=3.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.5.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for pyopenssl, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, pyopenssl
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for pyopenssl ... done
Successfully installed cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 pyopenssl-20.0.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting service_identity>=18.1.0
  Using cached https://files.pythonhosted.org/packages/9a/3d/9eb0563e066ea0540cf580695593ab079376e920016d4d1b3ff2fd8abf4b/service_identity-18.1.0.tar.gz
  Installing build dependencies ... done
Collecting attrs>=16.0.0 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting pyasn1-modules (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/88/87/72eb9ccf8a58021c542de2588a867dbefc7556e14b2866d1e40e9e2b587e/pyasn1-modules-0.2.8.tar.gz
Collecting pyasn1 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/a4/db/fffec68299e6d7bad3d504147f9094830b704527a7fc098b721d38cc7fa7/pyasn1-0.4.8.tar.gz
Collecting cryptography (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.4.1 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for service-identity, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1-modules, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: attrs, pyasn1, pyasn1-modules, six, pycparser, cffi, cryptography, service-identity
  Running setup.py install for attrs ... done
  Running setup.py install for pyasn1 ... done
  Running setup.py install for pyasn1-modules ... done
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for service-identity ... done
Successfully installed attrs-20.3.0 cffi-1.14.4 cryptography-3.2.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.20 service-identity-18.1.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/attr already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/attrs-20.3.0-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting idna!=2.3,>=0.6
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Installing collected packages: idna
  Running setup.py install for idna ... done
Successfully installed idna-2.10
Target directory /home/pi/.platformio/packages/contrib-pysite/idna already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/idna-2.10.egg-info already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting zeroconf==0.26.0
  Using cached https://files.pythonhosted.org/packages/d1/fc/adab674bf986b6db84fc976ee4921460eb9c9334c8c475abcc55169e8711/zeroconf-0.26.0.tar.gz
  Installing build dependencies ... done
Collecting ifaddr (from zeroconf==0.26.0)
  Using cached https://files.pythonhosted.org/packages/3d/fc/4ce147e3997cd0ea470ad27112087545cf83bf85015ddb3054673cb471bb/ifaddr-0.1.7.tar.gz
Skipping bdist_wheel for zeroconf, due to binaries being disabled for it.
Skipping bdist_wheel for ifaddr, due to binaries being disabled for it.
Installing collected packages: ifaddr, zeroconf
  Running setup.py install for ifaddr ... done
  Running setup.py install for zeroconf ... done
Successfully installed ifaddr-0.1.7 zeroconf-0.26.0
Error: Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/command.py", line 60, in remote_agent_start
    from platformio.commands.remote.client.agent_service import RemoteAgentService
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/client/agent_service.py", line 25, in <module>
    from platformio.commands.remote.client.base import RemoteClientBase
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/client/base.py", line 30, in <module>
    from platformio.commands.remote.factory.ssl import SSLContextFactory
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/factory/ssl.py", line 16, in <module>
    from OpenSSL import SSL  # pylint: disable=import-error
  File "/home/pi/.platformio/packages/contrib-pysite/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/pi/.platformio/packages/contrib-pysite/OpenSSL/crypto.py", line 14, in <module>
    from cryptography import utils, x509
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/base.py", line 15, in <module>
    from cryptography.hazmat.backends import _get_backend
ImportError: cannot import name '_get_backend' from 'cryptography.hazmat.backends' (/home/pi/.platformio/packages/contrib-pysite/cryptography/hazmat/backends/__init__.py)

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

What I have to do?

ImportError: cannot import name certificate_transparency · Issue #865 · pyca/pyopenssl · GitHub seems to apply here. Does sudo dpkg -l | grep cryptography and pip list | grep cryptography output some packages? If both dpkg and pip have (python) cryptography packages, that’s bad. In this case you would do a sudo apt purge python3-cryptography.

Also already tracked in pio remote agent throw's exception on raspberry pi's (5.0.0) · Issue #3652 · platformio/platformio-core · GitHub and Broken package: cryptography · Issue #151 · piwheels/packages · GitHub.

Hi maxgerhardt

Thanks for the time you are dedicating to me.

I had both.
I follow your suggestion:

pi@test:~ $ sudo dpkg -l | grep cryptography
ii  python3-cryptography               2.6.1-3+deb10u2                      armhf        Python library exposing cryptog
raphic recipes and primitives (Python 3)
pi@test:~ $ pip3 list | grep cryptography
cryptography     3.2.1
pi@test:~ $ sudo apt purge python3-cryptography
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libbdplus0 libssh-gcrypt-4 libtwolame0 libva-drm2 libvpx5 libwavpack1 libx264-155 libx265-165 python3-asn1crypto
  python3-cffi-backend python3-dbus python3-entrypoints rpi-eeprom-images
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  python3-cryptography* python3-keyring* python3-secretstorage*
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 1,476 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 73143 files and directories currently installed.)
Removing python3-keyring (17.1.1-1) ...
Removing python3-secretstorage (2.3.1-2) ...
Removing python3-cryptography (2.6.1-3+deb10u2) ...
Processing triggers for man-db (2.8.5-2) ...
pi@test:~ $ 

Then i run again pio update getting

pi@test:~ $ pio update
Updating platformio/contrib-piohome           3.3.1 @ ~3.3.1                     [Up-to-date]
Updating platformio/contrib-pysite            2.37.201206 @ ~2.37.0              [Outdated 2.37.191020]
Tool Manager: Installing platformio/contrib-pysite @ 2.37.191020
Unpacking  [####################################]  100%
Tool Manager: contrib-pysite @ 2.37.191020 has been installed!
Tool Manager: Removing contrib-pysite @ 2.37.201206
Tool Manager: contrib-pysite @ 2.37.201206 has been removed!
Updating platformio/tool-scons                4.40001.0 @ ~4.40001.0             [Up-to-date]

Platform Manager
================
Platform atmelavr
--------
Updating platformio/atmelavr                  3.0.0                              [Up-to-date]
Updating platformio/framework-arduino-avr     5.1.0 @ ~5.1.0                     [Up-to-date]
Updating platformio/tool-avrdude              1.60300.200527 @ ~1.60300.0        [Up-to-date]

Platform espressif32
--------
Updating platformio/espressif32               2.1.0                              [Up-to-date]
Updating platformio/toolchain-xtensa32        2.50200.80 @ ~2.50200.0            [Up-to-date]
Updating platformio/framework-arduinoespressif32 3.10004.201016 @ ~3.10004.191002   [Up-to-date]
Updating platformio/tool-mkspiffs             2.230.0 @ ~2.230.0                 [Up-to-date]
Tool Manager: Removing tool-esptoolpy @ 1.20800.0
Tool Manager: tool-esptoolpy @ 1.20800.0 has been removed!

Platform espressif8266
--------
Updating platformio/espressif8266             2.6.2                              [Up-to-date]
Updating platformio/toolchain-xtensa          2.40802.200502 @ ~2.40802.191122   [Up-to-date]
Updating platformio/framework-arduinoespressif8266 3.20704.0 @ ~3.20704.0             [Up-to-date]
Updating platformio/tool-esptool              1.413.0 @ <2                       [Up-to-date]
Updating platformio/tool-mkspiffs             1.200.0 @ ~1.200.0                 [Up-to-date]
Updating platformio/tool-mklittlefs           1.203.200522 @ ~1.203.0            [Up-to-date]
Tool Manager: Removing tool-esptoolpy @ 1.20600.0
Tool Manager: tool-esptoolpy @ 1.20600.0 has been removed!


Library Manager
===============
Library Storage: /home/pi/.platformio/lib

But if I run again 'pio

pi@test:~ $ pio remote agent start
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting twisted==20.3.0
  Using cached https://files.pythonhosted.org/packages/4a/b4/4973c7ccb5be2ec0abc779b7d5f9d5f24b17b0349e23240cfc9dc3bd83cc/Twisted-20.3.0.tar.bz2
Collecting Automat>=0.3.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/80/c5/82c63bad570f4ef745cc5c2f0713c8eddcd07153b4bee7f72a8dc9f9384b/Automat-20.2.0.tar.gz
Collecting PyHamcrest!=1.10.0,>=1.9.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/58/05/7b993fabb44ff0b52a90916d96bfd91a65ecf90b8248e72bba325ba8e438/PyHamcrest-2.0.2.tar.gz
Collecting attrs>=19.2.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting constantly>=15.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/95/f1/207a0a478c4bb34b1b49d5915e2db574cadc415c9ac3a7ef17e29b2e8951/constantly-15.1.0.tar.gz
Collecting hyperlink>=17.1.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/b7/bf/ecacc60e63d65f7449457bbd8163141c51c4af7aeff7958ec061b8faf915/hyperlink-20.0.1.tar.gz
  Installing build dependencies ... done
Collecting incremental>=16.10.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/8f/26/02c4016aa95f45479eea37c90c34f8fab6775732ae62587a874b619ca097/incremental-17.5.0.tar.gz
Collecting zope.interface>=4.4.2 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/84/21/80cdc749908ebf2719a9063eddcc02b668fbc62d200c1f1a4d92aaaba76b/zope.interface-5.2.0.tar.gz
Collecting six (from Automat>=0.3.0->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting idna>=2.5 (from hyperlink>=17.1.1->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Collecting setuptools (from zope.interface>=4.4.2->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/a7/e0/30642b9c2df516506d40b563b0cbd080c49c6b3f11a70b4c7a670f13a78b/setuptools-50.3.2.zip
Skipping bdist_wheel for twisted, due to binaries being disabled for it.
Skipping bdist_wheel for Automat, due to binaries being disabled for it.
Skipping bdist_wheel for PyHamcrest, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for constantly, due to binaries being disabled for it.
Skipping bdist_wheel for hyperlink, due to binaries being disabled for it.
Skipping bdist_wheel for incremental, due to binaries being disabled for it.
Skipping bdist_wheel for zope.interface, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Skipping bdist_wheel for setuptools, due to binaries being disabled for it.
Installing collected packages: attrs, six, Automat, PyHamcrest, constantly, idna, hyperlink, incremental, setuptools, zope.interface, twisted
  Running setup.py install for attrs ... done
  Running setup.py install for six ... done
  Running setup.py install for Automat ... done
  Running setup.py install for PyHamcrest ... done
  Running setup.py install for constantly ... done
  Running setup.py install for idna ... done
  Running setup.py install for hyperlink ... done
  Running setup.py install for incremental ... done
  Running setup.py install for setuptools ... done
  Running setup.py install for zope.interface ... done
  Running setup.py install for twisted ... done
Successfully installed Automat-20.2.0 PyHamcrest-2.0.2 attrs-20.3.0 constantly-15.1.0 hyperlink-20.0.1 idna-2.10 incremental-17.5.0 setuptools-50.3.2 six-1.15.0 twisted-20.3.0 zope.interface-5.2.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting autobahn==20.7.1
  Using cached https://files.pythonhosted.org/packages/f2/f2/3408aefd435b5e0a4f4f36022401d6c86ff1abe85af1d308cd6d07073e72/autobahn-20.7.1.tar.gz
Collecting cryptography>=2.7 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting txaio>=20.3.1 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/e7/dd/c0c90b080c3fad0ac8e2382eddbe86591d4fa1a5c1aea652de0adf245fc0/txaio-20.4.1.tar.gz
Collecting six>=1.4.1 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for autobahn, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for txaio, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, txaio, autobahn
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for txaio ... done
  Running setup.py install for autobahn ... done
Successfully installed autobahn-20.7.1 cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 six-1.15.0 txaio-20.4.1
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/twisted already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/bin already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting json-rpc==1.13.0
  Using cached https://files.pythonhosted.org/packages/43/5a/7c2ea59e622682fff34d5aa3b301aa9a10bb0dbf0120f85cd391e4badad8/json-rpc-1.13.0.tar.gz
Skipping bdist_wheel for json-rpc, due to binaries being disabled for it.
Installing collected packages: json-rpc
  Running setup.py install for json-rpc ... done
Successfully installed json-rpc-1.13.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyopenssl>=16.0.0
  Using cached https://files.pythonhosted.org/packages/09/67/38a1080fabbb908515c47694238e00b6a73a82d9dbc76372263a231abfcb/pyOpenSSL-20.0.0.tar.gz
  Installing build dependencies ... done
Collecting cryptography>=3.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.5.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for pyopenssl, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, pyopenssl
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for pyopenssl ... done
Successfully installed cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 pyopenssl-20.0.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting service_identity>=18.1.0
  Using cached https://files.pythonhosted.org/packages/9a/3d/9eb0563e066ea0540cf580695593ab079376e920016d4d1b3ff2fd8abf4b/service_identity-18.1.0.tar.gz
  Using cached https://files.pythonhosted.org/packages/9a/3d/9eb0563e066ea0540cf580695593ab079376e920016d4d1b3ff2fd8abf4b/service_identity-18.1.0.tar.gz
  Installing build dependencies ... done
Collecting attrs>=16.0.0 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting pyasn1-modules (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/88/87/72eb9ccf8a58021c542de2588a867dbefc7556e14b2866d1e40e9e2b587e/pyasn1-modules-0.2.8.tar.gz
Collecting pyasn1 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/a4/db/fffec68299e6d7bad3d504147f9094830b704527a7fc098b721d38cc7fa7/pyasn1-0.4.8.tar.gz
Collecting cryptography (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.4.1 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for service-identity, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1-modules, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: attrs, pyasn1, pyasn1-modules, six, pycparser, cffi, cryptography, service-identity
  Running setup.py install for attrs ... done
  Running setup.py install for pyasn1 ... done
  Running setup.py install for pyasn1-modules ... done
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for service-identity ... done
Successfully installed attrs-20.3.0 cffi-1.14.4 cryptography-3.2.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.20 service-identity-18.1.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/attr already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/attrs-20.3.0-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting idna!=2.3,>=0.6
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Installing collected packages: idna
  Running setup.py install for idna ... done
Successfully installed idna-2.10
Target directory /home/pi/.platformio/packages/contrib-pysite/idna already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/idna-2.10.egg-info already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting zeroconf==0.26.0
  Using cached https://files.pythonhosted.org/packages/d1/fc/adab674bf986b6db84fc976ee4921460eb9c9334c8c475abcc55169e8711/zeroconf-0.26.0.tar.gz
  Installing build dependencies ... done
Collecting ifaddr (from zeroconf==0.26.0)
  Using cached https://files.pythonhosted.org/packages/3d/fc/4ce147e3997cd0ea470ad27112087545cf83bf85015ddb3054673cb471bb/ifaddr-0.1.7.tar.gz
Skipping bdist_wheel for zeroconf, due to binaries being disabled for it.
Skipping bdist_wheel for ifaddr, due to binaries being disabled for it.
Installing collected packages: ifaddr, zeroconf
  Running setup.py install for ifaddr ... done
  Running setup.py install for zeroconf ... done
Successfully installed ifaddr-0.1.7 zeroconf-0.26.0
Error: Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/command.py", line 60, in remote_agent_start
    from platformio.commands.remote.client.agent_service import RemoteAgentService
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/client/agent_service.py", line 25, in <module>
    from platformio.commands.remote.client.base import RemoteClientBase
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/client/base.py", line 30, in <module>
    from platformio.commands.remote.factory.ssl import SSLContextFactory
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/factory/ssl.py", line 16, in <module>
    from OpenSSL import SSL  # pylint: disable=import-error
  File "/home/pi/.platformio/packages/contrib-pysite/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/pi/.platformio/packages/contrib-pysite/OpenSSL/crypto.py", line 14, in <module>
    from cryptography import utils, x509
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/base.py", line 15, in <module>
    from cryptography.hazmat.backends import _get_backend
ImportError: cannot import name '_get_backend' from 'cryptography.hazmat.backends' (/home/pi/.platformio/packages/contrib-pysite/cryptography/hazmat/backends/__init__.py)

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

pi@test:~ $

So, looks that it is not fixed :frowning:

Execute pio upgrade --dev to update to the latest core version and restart the agent. Does it work now?

If i run

pi@test:~ $ pio upgrade --dev
Please wait while upgrading PlatformIO ...
PlatformIO has been successfully upgraded to 5.0.4b1
Release notes: https://docs.platformio.org/en/latest/history.html

and then

pi@test:~ $ pio remote agent start
2020-12-06 15:22:04 [info] Name: test
2020-12-06 15:22:04 [info] Connecting to PlatformIO Remote Development Cloud
2020-12-06 15:22:04 [info] Successfully connected
2020-12-06 15:22:04 [info] Authenticating
2020-12-06 15:22:04 [info] Successfully authorized
^C2020-12-06 15:22:40 [info] Successfully disconnected

Looks fine, but if I run

pi@test:~ $ pio update
Updating platformio/contrib-piohome           3.3.1 @ ~3.3.1                     [Up-to-date]
Updating platformio/contrib-pysite            2.37.201206 @ ~2.37.0              [Outdated 2.37.191020]
Tool Manager: Installing platformio/contrib-pysite @ 2.37.191020
Unpacking  [####################################]  100%
Tool Manager: contrib-pysite @ 2.37.191020 has been installed!
Tool Manager: Removing contrib-pysite @ 2.37.201206
Tool Manager: contrib-pysite @ 2.37.201206 has been removed!
Updating platformio/tool-scons                4.40001.0 @ ~4.40001.0             [Up-to-date]

Platform Manager
================
Platform atmelavr
--------
Updating platformio/atmelavr                  3.0.0                              [Up-to-date]
Updating platformio/framework-arduino-avr     5.1.0 @ ~5.1.0                     [Up-to-date]
Updating platformio/tool-avrdude              1.60300.200527 @ ~1.60300.0        [Up-to-date]

Platform espressif32
--------
Updating platformio/espressif32               2.1.0                              [Up-to-date]
Updating platformio/toolchain-xtensa32        2.50200.80 @ ~2.50200.0            [Up-to-date]
Updating platformio/framework-arduinoespressif32 3.10004.201016 @ ~3.10004.191002   [Up-to-date]
Updating platformio/tool-mkspiffs             2.230.0 @ ~2.230.0                 [Up-to-date]

Platform espressif8266
--------
Updating platformio/espressif8266             2.6.2                              [Up-to-date]
Updating platformio/toolchain-xtensa          2.40802.200502 @ ~2.40802.191122   [Up-to-date]
Updating platformio/framework-arduinoespressif8266 3.20704.0 @ ~3.20704.0             [Up-to-date]
Updating platformio/tool-esptool              1.413.0 @ <2                       [Up-to-date]
Updating platformio/tool-mkspiffs             1.200.0 @ ~1.200.0                 [Up-to-date]
Updating platformio/tool-mklittlefs           1.203.200522 @ ~1.203.0            [Up-to-date]


Library Manager
===============
Library Storage: /home/pi/.platformio/lib

When I run the agent, I got

pi@test:~ $ pio remote agent start
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting twisted==20.3.0
  Using cached https://files.pythonhosted.org/packages/4a/b4/4973c7ccb5be2ec0abc779b7d5f9d5f24b17b0349e23240cfc9dc3bd83cc/Twisted-20.3.0.tar.bz2
Collecting Automat>=0.3.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/80/c5/82c63bad570f4ef745cc5c2f0713c8eddcd07153b4bee7f72a8dc9f9384b/Automat-20.2.0.tar.gz
Collecting PyHamcrest!=1.10.0,>=1.9.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/58/05/7b993fabb44ff0b52a90916d96bfd91a65ecf90b8248e72bba325ba8e438/PyHamcrest-2.0.2.tar.gz
Collecting attrs>=19.2.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting constantly>=15.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/95/f1/207a0a478c4bb34b1b49d5915e2db574cadc415c9ac3a7ef17e29b2e8951/constantly-15.1.0.tar.gz
Collecting hyperlink>=17.1.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/b7/bf/ecacc60e63d65f7449457bbd8163141c51c4af7aeff7958ec061b8faf915/hyperlink-20.0.1.tar.gz
  Installing build dependencies ... done
Collecting incremental>=16.10.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/8f/26/02c4016aa95f45479eea37c90c34f8fab6775732ae62587a874b619ca097/incremental-17.5.0.tar.gz
Collecting zope.interface>=4.4.2 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/84/21/80cdc749908ebf2719a9063eddcc02b668fbc62d200c1f1a4d92aaaba76b/zope.interface-5.2.0.tar.gz
Collecting six (from Automat>=0.3.0->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting idna>=2.5 (from hyperlink>=17.1.1->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Collecting setuptools (from zope.interface>=4.4.2->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/a7/e0/30642b9c2df516506d40b563b0cbd080c49c6b3f11a70b4c7a670f13a78b/setuptools-50.3.2.zip
Skipping bdist_wheel for twisted, due to binaries being disabled for it.
Skipping bdist_wheel for Automat, due to binaries being disabled for it.
Skipping bdist_wheel for PyHamcrest, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for constantly, due to binaries being disabled for it.
Skipping bdist_wheel for hyperlink, due to binaries being disabled for it.
Skipping bdist_wheel for incremental, due to binaries being disabled for it.
Skipping bdist_wheel for zope.interface, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Skipping bdist_wheel for setuptools, due to binaries being disabled for it.
Installing collected packages: attrs, six, Automat, PyHamcrest, constantly, idna, hyperlink, incremental, setuptools, zope.interface, twisted
  Running setup.py install for attrs ... done
  Running setup.py install for six ... done
  Running setup.py install for Automat ... done
  Running setup.py install for PyHamcrest ... done
  Running setup.py install for constantly ... done
  Running setup.py install for idna ... done
  Running setup.py install for hyperlink ... done
  Running setup.py install for incremental ... done
  Running setup.py install for setuptools ... done
  Running setup.py install for zope.interface ... done
  Running setup.py install for twisted ... done
Successfully installed Automat-20.2.0 PyHamcrest-2.0.2 attrs-20.3.0 constantly-15.1.0 hyperlink-20.0.1 idna-2.10 incremental-17.5.0 setuptools-50.3.2 six-1.15.0 twisted-20.3.0 zope.interface-5.2.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting autobahn==20.7.1
  Using cached https://files.pythonhosted.org/packages/f2/f2/3408aefd435b5e0a4f4f36022401d6c86ff1abe85af1d308cd6d07073e72/autobahn-20.7.1.tar.gz
Collecting cryptography>=2.7 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting txaio>=20.3.1 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/e7/dd/c0c90b080c3fad0ac8e2382eddbe86591d4fa1a5c1aea652de0adf245fc0/txaio-20.4.1.tar.gz
Collecting six>=1.4.1 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for autobahn, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for txaio, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, txaio, autobahn
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for txaio ... done
  Running setup.py install for autobahn ... done
Successfully installed autobahn-20.7.1 cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 six-1.15.0 txaio-20.4.1
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/twisted already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/bin already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting json-rpc==1.13.0
  Using cached https://files.pythonhosted.org/packages/43/5a/7c2ea59e622682fff34d5aa3b301aa9a10bb0dbf0120f85cd391e4badad8/json-rpc-1.13.0.tar.gz
Skipping bdist_wheel for json-rpc, due to binaries being disabled for it.
Installing collected packages: json-rpc
  Running setup.py install for json-rpc ... done
Successfully installed json-rpc-1.13.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyopenssl>=16.0.0
  Using cached https://files.pythonhosted.org/packages/09/67/38a1080fabbb908515c47694238e00b6a73a82d9dbc76372263a231abfcb/pyOpenSSL-20.0.0.tar.gz
  Installing build dependencies ... done
Collecting cryptography>=3.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.5.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for pyopenssl, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, pyopenssl
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for pyopenssl ... done
Successfully installed cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 pyopenssl-20.0.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting service_identity>=18.1.0
  Using cached https://files.pythonhosted.org/packages/9a/3d/9eb0563e066ea0540cf580695593ab079376e920016d4d1b3ff2fd8abf4b/service_identity-18.1.0.tar.gz
  Installing build dependencies ... done
Collecting attrs>=16.0.0 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting pyasn1-modules (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/88/87/72eb9ccf8a58021c542de2588a867dbefc7556e14b2866d1e40e9e2b587e/pyasn1-modules-0.2.8.tar.gz
Collecting pyasn1 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/a4/db/fffec68299e6d7bad3d504147f9094830b704527a7fc098b721d38cc7fa7/pyasn1-0.4.8.tar.gz
Collecting cryptography (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.4.1 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for service-identity, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1-modules, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: attrs, pyasn1, pyasn1-modules, six, pycparser, cffi, cryptography, service-identity
  Running setup.py install for attrs ... done
  Running setup.py install for pyasn1 ... done
  Running setup.py install for pyasn1-modules ... done
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for service-identity ... done
Successfully installed attrs-20.3.0 cffi-1.14.4 cryptography-3.2.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.20 service-identity-18.1.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/attr already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/attrs-20.3.0-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting idna!=2.3,>=0.6
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Installing collected packages: idna
  Running setup.py install for idna ... done
Successfully installed idna-2.10
Target directory /home/pi/.platformio/packages/contrib-pysite/idna already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/idna-2.10.egg-info already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting zeroconf==0.26.0
  Using cached https://files.pythonhosted.org/packages/d1/fc/adab674bf986b6db84fc976ee4921460eb9c9334c8c475abcc55169e8711/zeroconf-0.26.0.tar.gz
  Installing build dependencies ... done
Collecting ifaddr (from zeroconf==0.26.0)
  Using cached https://files.pythonhosted.org/packages/3d/fc/4ce147e3997cd0ea470ad27112087545cf83bf85015ddb3054673cb471bb/ifaddr-0.1.7.tar.gz
Skipping bdist_wheel for zeroconf, due to binaries being disabled for it.
Skipping bdist_wheel for ifaddr, due to binaries being disabled for it.
Installing collected packages: ifaddr, zeroconf
  Running setup.py install for ifaddr ... done
  Running setup.py install for zeroconf ... done
Successfully installed ifaddr-0.1.7 zeroconf-0.26.0
Error: Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/command.py", line 60, in remote_agent_start
    from platformio.commands.remote.client.agent_service import RemoteAgentService
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/client/agent_service.py", line 25, in <module>
    from platformio.commands.remote.client.base import RemoteClientBase
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/client/base.py", line 30, in <module>
    from platformio.commands.remote.factory.ssl import SSLContextFactory
  File "/home/pi/.local/lib/python3.7/site-packages/platformio/commands/remote/factory/ssl.py", line 16, in <module>
    from OpenSSL import SSL  # pylint: disable=import-error
  File "/home/pi/.platformio/packages/contrib-pysite/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/pi/.platformio/packages/contrib-pysite/OpenSSL/crypto.py", line 14, in <module>
    from cryptography import utils, x509
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/base.py", line 15, in <module>
    from cryptography.hazmat.backends import _get_backend
ImportError: cannot import name '_get_backend' from 'cryptography.hazmat.backends' (/home/pi/.platformio/packages/contrib-pysite/cryptography/hazmat/backends/__init__.py)

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

pi@test:~ $

Looks same results :frowning:

Huh so starting pio remote agent start once is okay but then updating contrib-pysite package and re-running pio remote agent start breaks it again? But the update also immediately removes contrib-pysite again?

Which should be the right sequence to have my remote station updated ,upgrated and running? I guess:

pio update
pio upgrade --dev
pio remote agent start

Did you confirm?

Well first the core update and then the platform update I would say, so 1 and 2 reversed. But since you’ve already upgraded once this doesn’t make a difference now.

If you’re sure you’ve got all the latest versions now and don’t have the python3-cryptography package installed anymore then I’m not sure why it still fails to import the backend. You can open an issue at https://github.com/platformio/platformio-core/issues with all information (what pi, what distributation, what software versions, …) for further help.

Could you remove this folder /home/pi/.platformio/packages/contrib-pysite/cryptography and start agent again? It should re-compile pysite package on your machine.

Fantastic! it works now!

pi@test:~ $ pio remote agent start
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting twisted==20.3.0
  Using cached https://files.pythonhosted.org/packages/4a/b4/4973c7ccb5be2ec0abc779b7d5f9d5f24b17b0349e23240cfc9dc3bd83cc/Twisted-20.3.0.tar.bz2
Collecting Automat>=0.3.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/80/c5/82c63bad570f4ef745cc5c2f0713c8eddcd07153b4bee7f72a8dc9f9384b/Automat-20.2.0.tar.gz
Collecting PyHamcrest!=1.10.0,>=1.9.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/58/05/7b993fabb44ff0b52a90916d96bfd91a65ecf90b8248e72bba325ba8e438/PyHamcrest-2.0.2.tar.gz
Collecting attrs>=19.2.0 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting constantly>=15.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/95/f1/207a0a478c4bb34b1b49d5915e2db574cadc415c9ac3a7ef17e29b2e8951/constantly-15.1.0.tar.gz
Collecting hyperlink>=17.1.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/b7/bf/ecacc60e63d65f7449457bbd8163141c51c4af7aeff7958ec061b8faf915/hyperlink-20.0.1.tar.gz
  Installing build dependencies ... done
Collecting incremental>=16.10.1 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/8f/26/02c4016aa95f45479eea37c90c34f8fab6775732ae62587a874b619ca097/incremental-17.5.0.tar.gz
Collecting zope.interface>=4.4.2 (from twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/84/21/80cdc749908ebf2719a9063eddcc02b668fbc62d200c1f1a4d92aaaba76b/zope.interface-5.2.0.tar.gz
Collecting six (from Automat>=0.3.0->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting idna>=2.5 (from hyperlink>=17.1.1->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Collecting setuptools (from zope.interface>=4.4.2->twisted==20.3.0)
  Using cached https://files.pythonhosted.org/packages/12/e1/b9a2926a3c5a3fb055b8f85052f5baa890106a0e21b64a977c10affea751/setuptools-51.0.0.zip
Skipping bdist_wheel for twisted, due to binaries being disabled for it.
Skipping bdist_wheel for Automat, due to binaries being disabled for it.
Skipping bdist_wheel for PyHamcrest, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for constantly, due to binaries being disabled for it.
Skipping bdist_wheel for hyperlink, due to binaries being disabled for it.
Skipping bdist_wheel for incremental, due to binaries being disabled for it.
Skipping bdist_wheel for zope.interface, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Skipping bdist_wheel for setuptools, due to binaries being disabled for it.
Installing collected packages: attrs, six, Automat, PyHamcrest, constantly, idna, hyperlink, incremental, setuptools, zope.interface, twisted
  Running setup.py install for attrs ... done
  Running setup.py install for six ... done
  Running setup.py install for Automat ... done
  Running setup.py install for PyHamcrest ... done
  Running setup.py install for constantly ... done
  Running setup.py install for idna ... done
  Running setup.py install for hyperlink ... done
  Running setup.py install for incremental ... done
  Running setup.py install for setuptools ... done
  Running setup.py install for zope.interface ... done
  Running setup.py install for twisted ... done
Successfully installed Automat-20.2.0 PyHamcrest-2.0.2 attrs-20.3.0 constantly-15.1.0 hyperlink-20.0.1 idna-2.10 incremental-17.5.0 setuptools-51.0.0 six-1.15.0 twisted-20.3.0 zope.interface-5.2.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting autobahn==20.7.1
  Using cached https://files.pythonhosted.org/packages/f2/f2/3408aefd435b5e0a4f4f36022401d6c86ff1abe85af1d308cd6d07073e72/autobahn-20.7.1.tar.gz
Collecting cryptography>=2.7 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting txaio>=20.3.1 (from autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/e7/dd/c0c90b080c3fad0ac8e2382eddbe86591d4fa1a5c1aea652de0adf245fc0/txaio-20.4.1.tar.gz
Collecting six>=1.4.1 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=2.7->autobahn==20.7.1)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for autobahn, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for txaio, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, txaio, autobahn
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for txaio ... done
  Running setup.py install for autobahn ... done
Successfully installed autobahn-20.7.1 cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 six-1.15.0 txaio-20.4.1
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/twisted already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/bin already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting json-rpc==1.13.0
  Using cached https://files.pythonhosted.org/packages/43/5a/7c2ea59e622682fff34d5aa3b301aa9a10bb0dbf0120f85cd391e4badad8/json-rpc-1.13.0.tar.gz
Skipping bdist_wheel for json-rpc, due to binaries being disabled for it.
Installing collected packages: json-rpc
  Running setup.py install for json-rpc ... done
Successfully installed json-rpc-1.13.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyopenssl>=16.0.0
  Using cached https://files.pythonhosted.org/packages/09/67/38a1080fabbb908515c47694238e00b6a73a82d9dbc76372263a231abfcb/pyOpenSSL-20.0.0.tar.gz
  Installing build dependencies ... done
Collecting cryptography>=3.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.5.2 (from pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=3.2->pyopenssl>=16.0.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for pyopenssl, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: six, pycparser, cffi, cryptography, pyopenssl
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for pyopenssl ... done
Successfully installed cffi-1.14.4 cryptography-3.2.1 pycparser-2.20 pyopenssl-20.0.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting service_identity>=18.1.0
  Using cached https://files.pythonhosted.org/packages/9a/3d/9eb0563e066ea0540cf580695593ab079376e920016d4d1b3ff2fd8abf4b/service_identity-18.1.0.tar.gz
  Installing build dependencies ... done
Collecting attrs>=16.0.0 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/f0/cb/80a4a274df7da7b8baf083249b0890a0579374c3d74b5ac0ee9291f912dc/attrs-20.3.0.tar.gz
  Installing build dependencies ... done
Collecting pyasn1-modules (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/88/87/72eb9ccf8a58021c542de2588a867dbefc7556e14b2866d1e40e9e2b587e/pyasn1-modules-0.2.8.tar.gz
Collecting pyasn1 (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/a4/db/fffec68299e6d7bad3d504147f9094830b704527a7fc098b721d38cc7fa7/pyasn1-0.4.8.tar.gz
Collecting cryptography (from service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz
  Installing build dependencies ... done
Collecting six>=1.4.1 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz
Collecting cffi!=1.11.3,>=1.8 (from cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography->service_identity>=18.1.0)
  Using cached https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz
Skipping bdist_wheel for service-identity, due to binaries being disabled for it.
Skipping bdist_wheel for attrs, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1-modules, due to binaries being disabled for it.
Skipping bdist_wheel for pyasn1, due to binaries being disabled for it.
Skipping bdist_wheel for cryptography, due to binaries being disabled for it.
Skipping bdist_wheel for six, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: attrs, pyasn1, pyasn1-modules, six, pycparser, cffi, cryptography, service-identity
  Running setup.py install for attrs ... done
  Running setup.py install for pyasn1 ... done
  Running setup.py install for pyasn1-modules ... done
  Running setup.py install for six ... done
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for cryptography ... done
  Running setup.py install for service-identity ... done
Successfully installed attrs-20.3.0 cffi-1.14.4 cryptography-3.2.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.20 service-identity-18.1.0 six-1.15.0
Target directory /home/pi/.platformio/packages/contrib-pysite/attr already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi-1.14.4.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/attrs-20.3.0-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/_cffi_backend.cpython-37m-arm-linux-gnueabihf.so already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cryptography-3.2.1-py3.7.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six-1.15.0.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/pycparser-2.20.egg-info already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/cffi already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/six.py already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting idna!=2.3,>=0.6
  Using cached https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz
Skipping bdist_wheel for idna, due to binaries being disabled for it.
Installing collected packages: idna
  Running setup.py install for idna ... done
Successfully installed idna-2.10
Target directory /home/pi/.platformio/packages/contrib-pysite/idna already exists. Specify --upgrade to force replacement.
Target directory /home/pi/.platformio/packages/contrib-pysite/idna-2.10.egg-info already exists. Specify --upgrade to force replacement.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting zeroconf==0.26.0
  Using cached https://files.pythonhosted.org/packages/d1/fc/adab674bf986b6db84fc976ee4921460eb9c9334c8c475abcc55169e8711/zeroconf-0.26.0.tar.gz
  Installing build dependencies ... done
Collecting ifaddr (from zeroconf==0.26.0)
  Using cached https://files.pythonhosted.org/packages/3d/fc/4ce147e3997cd0ea470ad27112087545cf83bf85015ddb3054673cb471bb/ifaddr-0.1.7.tar.gz
Skipping bdist_wheel for zeroconf, due to binaries being disabled for it.
Skipping bdist_wheel for ifaddr, due to binaries being disabled for it.
Installing collected packages: ifaddr, zeroconf
  Running setup.py install for ifaddr ... done
  Running setup.py install for zeroconf ... done
Successfully installed ifaddr-0.1.7 zeroconf-0.26.0
2020-12-07 08:43:55 [info] Name: test
2020-12-07 08:43:55 [info] Connecting to PlatformIO Remote Development Cloud
2020-12-07 08:43:55 [info] Successfully connected
2020-12-07 08:43:55 [info] Authenticating
2020-12-07 08:43:55 [info] Successfully authorized
1 Like

Just did a fresh install via pip on RPI 4 and have the same issue. Deleting cryptography from contrib-pysite didn’t help. Do I still need to use the latest development version or run any update commands even though I just installed from scratch? As far as I understood, the fix is already longer merged and should be part of the stable distribution, shouldn’t it?

My pio version is 5.0.4.

And you did a sudo apt purge python3-cryptography too in case you have a local installation of it?

That is very close to the development version anyways as of now, but you can still try pio upgrade --dev

No, that did the trick, thanks!

I had been getting a “No module named _cffi_backend” exception in VSCode on MacOS while trying to connect to a remote running on a Pi4.

I tracked this down to Homebrew. I have an AppleSilicon based Mac but my iOS install was migrated from an Intel machine. For AppleSilicon, Homebrew migrated the base install path from ‘/usr/local/Cellar’ to ‘/opt/homebrew/Cellar’ so they could support executables both in old x86 under Rosetta and new M1.

My problem is that I had old Python and libffi installs under the x86 Homebrew. These don’t show up under “brew list” as that only lists AppleSilicon executables. I had to use “/usr/local/bin/brew list” and then remove all the redundant x86 Formulae with “/usr/local/bin/brew uninstall …”

On firing up VSCode, PlatformIO reconfigured and remote development seems to work perfectly