How to fix pio remote agent start: error: can't find Rust compiler


When running pio remote agent start, while PlatformIO installs the Python packages, you see an error log like

generating cffi module ‘build/temp.linux-armv7l-3.7/_openssl.c’
creating build/temp.linux-armv7l-3.7
running build_rust

  =============================DEBUG ASSISTANCE=============================                                                                                            
  If you are seeing a compilation error please try the following steps to                                                                                               
  successfully install cryptography:                                                                                                                                    
  1) Upgrade to the latest pip and try again. This will fix errors for most                                                                                             
     users. See:                                                                                                
  2) Read for specific                                                                                                  
     instructions for your platform.                                                                                                                                    
  3) Check our frequently asked questions for more information:                                                                                                                                                                                                                                  
  4) Ensure you have a recent Rust toolchain installed:                                                                                                                                                                                                                            
  Python: 3.7.3                                                                                                                                                         
  platform: Linux-5.10.60-v7l+-armv7l-with-debian-10.10                                                                                                                 
  pip: n/a                                                                                                                                                              
  setuptools: 58.2.0                                                                                                                                                    
  setuptools_rust: 0.12.1                                                                                                                                               
  =============================DEBUG ASSISTANCE=============================                                                                                            

error: can’t find Rust compiler

If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

To update pip, run:

  pip install --upgrade pip                                                                                                                                             

and then retry package installation.

If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at is the recommended way to download and update the Rust compiler toolchain.

This package requires Rust >=1.41.0.

ERROR: Failed building wheel for cryptography Successfully built pyopenssl Failed to build cryptography ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly Error: Traceback (most recent call last): File “/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/package/manager/”, line 127, in inject_contrib_pysite
from OpenSSL import SSL
File “/home/pi/.platformio/packages/contrib-pysite/OpenSSL/”, line 8, in
File “/home/pi/.platformio/packages/contrib-pysite/OpenSSL/”, line 12, in
File “/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/”, line 8, in
File “/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/”, line 18, in
File “/home/pi/.platformio/packages/contrib-pysite/cryptography/x509/”, line 20, in
File “/home/pi/.platformio/packages/contrib-pysite/cryptography/hazmat/primitives/”, line 11, in
ImportError: /home/pi/.platformio/packages/contrib-pysite/cryptography/hazmat/bindings/ cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/”, line 115, in main
cli() # pylint: disable=no-value-for-parameter
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/click/”, line 1137, in call
return self.main(*args, **kwargs)
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/click/”, line 1062, in main
rv = self.invoke(ctx)
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/commands/”, line 44, in invoke
return super(PlatformioCLI, self).invoke(ctx)
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/click/”, line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/click/”, line 1665, in invoke
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/click/”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/click/”, line 763, in invoke
return __callback(*args, **kwargs)
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/click/”, line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/commands/remote/”, line 40, in cli
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/package/manager/”, line 129, in inject_contrib_pysite
File “/home/pi/.platformio/penv/lib/python3.7/site-packages/platformio/package/manager/”, line 156, in build_contrib_pysite_package subprocess.check_call(args + [dep]) File “/usr/lib/python3.7/”, line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command ‘[’/home/pi/.platformio/penv/bin/python’, ‘-m’, ‘pip’, ‘install’, ‘–no-compile’, ‘-t’, ‘/home/pi/.platformio/packages/contrib-pysite’, ‘–no-binary’, ‘:all:’, ‘pyopenssl >= 16.0.0’]’ returned non-zero exit status 1.


An unexpected error occurred. Further steps:



You need to install rust using

sudo apt -y install rustc

and then run the original command again:

pio remote agent start