esp-rs / embuild

Build support for embedded Rust: Cargo integration with other embedded build ecosystems & tools, like PlatformIO, CMake and kconfig.
Apache License 2.0
139 stars 40 forks source link

Esp-idf installation is failing in Windows #64

Closed SergioGasquez closed 2 months ago

SergioGasquez commented 2 years ago

Hi! I think esp-idf installation is failing for Windows, I discovered the issue while working in espup, at first I thought I was doing something wrong (as it's my first from-scratch Rust project) but I managed to reproduce it with esp-idf-sys via esp-idf-template. Steps to reproduce:

  1. Generate an esp-idf-template project: In my case I generated for esp32 with std and v.4.4
  2. Export $Env:LIBCLANG_PATH="/.espressif/tools/xtensa-esp32-elf-clang/lib"
  3. Build the project. At this point, esp-idf-sys should download and install esp-idf under the .embuild directory. The build fails with:

    ERROR: Could not find a version that satisfies the requirement windows-curses; sys_platform == "win32" (from esp-windows-curses) (from versions: none)
    ERROR: No matching distribution found for windows-curses; sys_platform == "win32"
    Traceback (most recent call last):
    File "C:\Users\sergio\Documents\Espressif\tests\espidf-test\.embuild\espressif\esp-idf\release-v4.4\tools\idf_tools.py", line 1973, in <module>
      main(sys.argv[1:])
    File "C:\Users\sergio\Documents\Espressif\tests\espidf-test\.embuild\espressif\esp-idf\release-v4.4\tools\idf_tools.py", line 1969, in main
      action_func(args)
    File "C:\Users\sergio\Documents\Espressif\tests\espidf-test\.embuild\espressif\esp-idf\release-v4.4\tools\idf_tools.py", line 1619, in action_install_python_env
      subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr, env=env_copy)
    File "C:\Python311\Lib\subprocess.py", line 413, in check_call
      raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['C:\\Users\\sergio\\Documents\\Espressif\\tests\\espidf-test\\.embuild\\espressif\\python_env\\idf4.4_py3.11_env\\Scripts\\python.exe', '-m', 'pip', 'install', '--no-warn-script-location', '-r', 'C:\\Users\\sergio\\Documents\\Espressif\\tests\\espidf-test\\.embuild\\espressif\\esp-idf\\release-v4.4\\requirements.txt', '--extra-index-url', 'https://dl.espressif.com/pypi']' returned non-zero exit status 1.
    Error: Could not install esp-idf
    
    Caused by:
      command '"python" "C:\\Users\\sergio\\Documents\\Espressif\\tests\\espidf-test\\.embuild\\espressif\\esp-idf\\release-v4.4\\tools\\idf_tools.py" "--idf-path" "C:\\Users\\sergio\\Documents\\Espressif\\tests\\espidf-test\\.embuild\\espressif\\esp-idf\\release-v4.4" "--non-interactive" "install-python-env"' exited with non-zero status code 1

Again, I am no expert in embuild/esp-idf-sys and even less, in Windows, so let me know if I'm missing something.

SergioGasquez commented 2 years ago

After some more testing, I found out that the error comes from the Window install script. Both install.bat and ìnstall.ps1 are giving me the same error

SergioGasquez commented 2 years ago

Mistery solved, I was using python Python 3.11.0b5 which is a pre-release and there are no wheels for windows-curses for python 3.11. Running the installers with python 3.8.7 works fine. Now, the question is.... Should any check be done in embuild to avoid this situation?

SergioGasquez commented 2 years ago

Nevermind, browsing through embuild code I found out that there is already a TODO and a python version check, should we keep this issue open to address this todo and add a check to see that the version is lower than 3.11 ?