Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIO remote fails on new install (Ubuntu 24.04) due to missing CFFI dependency within penv #5050

Open
noisymime opened this issue Dec 16, 2024 · 0 comments

Comments

@noisymime
Copy link

Configuration

Operating system: Ubuntu 24.04.1 LTS

PlatformIO Version (platformio --version): 6.1.16

Description of problem

I performed an install of PIO onto a fresh Ubuntu 24.04 image using the current get_platformio.py script (https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py). The install completes without error, however attempting to run pio remote agent start produces the following error:

ModuleNotFoundError: Traceback (most recent call last):
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/platformio/__main__.py", line 103, in main
    cli()  # pylint: disable=no-value-for-parameter
    ^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/platformio/cli.py", line 85, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/platformio/remote/cli.py", line 68, in remote_agent_start
    from platformio.remote.client.agent_service import RemoteAgentService
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/platformio/remote/client/agent_service.py", line 27, in <module>
    from platformio.remote.client.base import RemoteClientBase
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/platformio/remote/client/base.py", line 30, in <module>
    from platformio.remote.factory.ssl import SSLContextFactory
  File "/home/xxxx/.platformio/penv/lib/python3.12/site-packages/platformio/remote/factory/ssl.py", line 16, in <module>
    from OpenSSL import SSL  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxxx/.platformio/packages/contrib-pioremote/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/home/xxxx/.platformio/packages/contrib-pioremote/OpenSSL/SSL.py", line 11, in <module>
    from OpenSSL._util import (
  File "/home/xxxx/.platformio/packages/contrib-pioremote/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/home/xxxx/.platformio/packages/contrib-pioremote/cryptography/hazmat/bindings/openssl/binding.py", line 15, in <module>
    from cryptography.exceptions import InternalError
  File "/home/xxxx/.platformio/packages/contrib-pioremote/cryptography/exceptions.py", line 9, in <module>
    from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
ModuleNotFoundError: No module named '_cffi_backend'

Having the system package python3-cffi installed does not resolve this as pio is looking for the library within its penv.

I had this issue immediately after updating from a working 22.04 Ubuntu system, but then reproduced it on an 'out of the box' Ubuntu 24.04.1 image also.

Resolution

Simply adding the cffi package into the platformio penv fixes this issue:

source ~/.platformio/penv/bin/activate
pip install cffi
deactivate

I'm not sure if this is as simple as just adding the cffi package to the python dependencies in the install script or not, but it seems to be a reproducible issue with current Ubuntu LTS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants