ESP32 Can't Build Project Anymore

I’m pretty new to platformio and the ESP32. I have a project where it was working fine before, and then all of a sudden when I opened it, it’s giving the following error when compiling during the build of the espidf dependencies:

 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 https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.

  This package requires Rust >=1.56.0.

  ----------------------------------------
  Running setup.py clean for cryptography
Failed to build cryptography
Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
You are using pip version 19.0.3, however version 23.2.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

I’ve tried to upgrade pip but the version used when recompiling seems to always be 19.0.3 despite the pip version being 23.2.1. I’ve also tried just installing cryptography and it seems to install fine.

What does your platformio.ini file look like?

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = espidf

Maybe something has broken in the virtual environment.

Delete

  • C:\Users\<user>\.platformio\platforms\espressif32
  • C:\Users\<user>\.platformio\penv\.espidf-*

and rebuidl the project.

Rebuilding the project resulted in the same error message. I did notice that the error message indicated that the platform was Windows 10. I am currently using Windows 11. Does that affect anything?

  warning: no files found matching '*.c' under directory 'src\_cffi_src'
  warning: no files found matching '*.h' under directory 'src\_cffi_src'
  no previously-included directories found matching 'docs\_build'
  warning: no previously-included files found matching 'vectors'
  warning: no previously-included files matching '*' found under directory 'vectors'
  warning: no previously-included files found matching 'src\rust\target'
  warning: no previously-included files matching '*' found under directory 'src\rust\target'
  warning: no previously-included files matching '*' found under directory '.github'
  warning: no previously-included files found matching 'release.py'
  warning: no previously-included files found matching '.readthedocs.yml'
  warning: no previously-included files found matching 'ci-constraints-requirements.txt'
  warning: no previously-included files found matching 'mypy.ini'
  adding license file 'LICENSE'
  adding license file 'LICENSE.APACHE'
  adding license file 'LICENSE.BSD'
  writing manifest file 'src\cryptography.egg-info\SOURCES.txt'
  copying src\cryptography\py.typed -> build\lib.win32-cpython-37\cryptography
  creating build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust
  copying src\cryptography\hazmat\bindings\_rust\__init__.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust
  copying src\cryptography\hazmat\bindings\_rust\_openssl.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust
  copying src\cryptography\hazmat\bindings\_rust\asn1.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust
  copying src\cryptography\hazmat\bindings\_rust\exceptions.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust
  copying src\cryptography\hazmat\bindings\_rust\ocsp.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust
  copying src\cryptography\hazmat\bindings\_rust\pkcs7.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust
  copying src\cryptography\hazmat\bindings\_rust\x509.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust
  creating build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\__init__.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\dh.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\dsa.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\ed25519.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\ed448.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\hashes.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\hmac.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\kdf.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\poly1305.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\x25519.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  copying src\cryptography\hazmat\bindings\_rust\openssl\x448.pyi -> build\lib.win32-cpython-37\cryptography\hazmat\bindings\_rust\openssl
  running build_ext
  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: https://pip.pypa.io/en/stable/installing/#upgrading-pip
      2) Read https://cryptography.io/en/latest/installation/ for specific
         instructions for your platform.
      3) Check our frequently asked questions for more information:
         https://cryptography.io/en/latest/faq/
      4) Ensure you have a recent Rust toolchain installed:
         https://cryptography.io/en/latest/installation/#rust
  
      Python: 3.7.4
      platform: Windows-10-10.0.22621-SP0
      pip: n/a
      setuptools: 68.0.0
      setuptools_rust: 1.7.0
      rustc: n/a
      =============================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 https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
  
  This package requires Rust >=1.56.0.
  
  ----------------------------------------
  Running setup.py clean for cryptography
  Failed building wheel for cryptography
Failed to build cryptography
Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
You are using pip version 19.0.3, however version 23.2.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
*** Error 1
Installing windows-curses package
Collecting windows-curses
  Using cached https://files.pythonhosted.org/packages/05/96/3373c0db049e8d6c8bbbcebf9b1e1aaa776c0f935cfaf08887b710003951/windows_curses-2.3.1-cp37-cp37m-win32.whl
Installing collected packages: windows-curses
Successfully installed windows-curses-2.3.1
You are using pip version 19.0.3, however version 23.2.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Reading CMake configuration...
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- Building ESP-IDF components for target esp32s3
-- Configuring incomplete, errors occurred!
See also "C:/Users/<user>/Documents/mcu/microcontroller/.pio/build/esp32-s3-devkitc-1/CMakeFiles/CMakeOutput.log".

fatal: not a git repository (or any of the parent directories): .git
CMake Error at C:/Users/<user>/.platformio/packages/framework-espidf/tools/cmake/build.cmake:540 (message):
  C:\Users\<user>\.platformio\penv\.espidf-5.1.1\Scripts\python.exe: Error
  while finding module specification for
  'idf_component_manager.prepare_components' (ModuleNotFoundError: No module
  named 'idf_component_manager')

Call Stack (most recent call first):
  C:/Users/<user>/.platformio/packages/framework-espidf/tools/cmake/project.cmake:547 (idf_build_process)
  CMakeLists.txt:8 (project)

Please file a bug with Issues · platformio/platform-espressif32 · GitHub.

I was able to fix the issue. Thank you for the hint. I went to the .platformio folder and deleted

  • C:\Users\<user>\.platformio\packages
  • C:\Users\<user>\.platformio\penv
  • C:\Users\<user>\.platformio\platforms

Once I rebuilt the project, the issues were fixed.