Pio remote agent not start

hello,
i use the platformio remote about 2 mounth,today i upgrade to latest version but now i can’t do nothing.
if try to launch “pio remote agent start” on my raspberry(where is connected the arduino)it return:

pi@raspberrypi:~ $ platformio remote agent start
Error: Traceback (most recent call last):
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/__main__.py", line 102, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/commands/__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/commands/remote/command.py", line 65, in remote_agent_start
    from platformio.commands.remote.client.agent_service import RemoteAgentService
  File "/home/pi/.platformio/penv/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/.platformio/penv/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/.platformio/penv/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 12, in <module>
    from cryptography import 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 18, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/extensions.py", line 20, in <module>
    from cryptography.hazmat.primitives import constant_time, serialization
  File "/home/pi/.platformio/packages/contrib-pysite/cryptography/hazmat/primitives/constant_time.py", line 11, in <module>
    from cryptography.hazmat.bindings._constant_time import lib
ImportError: /home/pi/.platformio/packages/contrib-pysite/cryptography/hazmat/bindings/_constant_time.abi3.so: cannot open shared object file: No such file or directory

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

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 can i do?

I had the same problem. I finally solved it by doing the following:

# python3.8 -m venv pio # create a new python virtual environment with name pio
# . pio/bin/activate # activate the new environment
# pip install pyopenssl
# pip install cffi
# pip install cryptography
# pip install platformio
# platformio remote agent start

You might still require some system packages (e.g. libffi, libffi-dev, libssl-dev)

There are also some other issues with the remote commands. Some are solved with python 3.8, others remain. For example, “platformio remote device monitor” will cause exceptions.

Cheers,
Karsten

1 Like

It should be fixed in the latest PIO Core version. Please re-run pio upgrade.

Hello,
I am trying to pio remote agent start on my raspberry pi and received this error. I have used pio upgrade also but the error hasnt resolved. Please help me out.

nisath@nisath-desktop:~$ pio remote agent start
AttributeError: Traceback (most recent call last):
  File "/home/nisath/.local/lib/python3.8/site-packages/platformio/__main__.py", line 103, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/nisath/.local/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/nisath/.local/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/nisath/.local/lib/python3.8/site-packages/platformio/cli.py", line 85, in invoke
    return super().invoke(ctx)
  File "/home/nisath/.local/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nisath/.local/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nisath/.local/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nisath/.local/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/nisath/.local/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/nisath/.local/lib/python3.8/site-packages/platformio/remote/cli.py", line 68, in remote_agent_start
    from platformio.remote.client.agent_service import RemoteAgentService
  File "/home/nisath/.local/lib/python3.8/site-packages/platformio/remote/client/agent_service.py", line 24, in <module>
    from platformio.remote.ac.process import ProcessAsyncCmd
  File "/home/nisath/.local/lib/python3.8/site-packages/platformio/remote/ac/process.py", line 17, in <module>
    from twisted.internet import protocol, reactor  # pylint: disable=import-error
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/reactor.py", line 38, in <module>
    from twisted.internet import default
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/default.py", line 55, in <module>
    install = _getInstallFunction(platform)
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/default.py", line 43, in _getInstallFunction
    from twisted.internet.epollreactor import install
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/epollreactor.py", line 19, in <module>
    from twisted.internet import posixbase
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/posixbase.py", line 16, in <module>
    from twisted.internet import error, tcp, udp
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/tcp.py", line 38, in <module>
    from twisted.internet._newtls import (
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/_newtls.py", line 18, in <module>
    from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/protocols/tls.py", line 45, in <module>
    from twisted.internet._sslverify import _setAcceptableProtocols
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/_sslverify.py", line 1828, in <module>
    defaultCiphers = OpenSSLAcceptableCiphers.fromOpenSSLCipherString(
  File "/home/nisath/.platformio/packages/contrib-pioremote/twisted/internet/_sslverify.py", line 1807, in fromOpenSSLCipherString
    SSL.TLS_METHOD,
  File "/usr/lib/python3/dist-packages/cryptography/utils.py", line 135, in __getattr__
    obj = getattr(self._module, attr)
AttributeError: module 'OpenSSL.SSL' has no attribute 'TLS_METHOD'

Thank you
Nisath