Fail to re-install and configure Espressif IDF extension in VSCode

samTPL
Posts: 11
Joined: Thu Jun 29, 2023 2:55 pm

Fail to re-install and configure Espressif IDF extension in VSCode

Postby samTPL » Tue Aug 15, 2023 11:37 am

Hello,

I am trying to install Espressif IDF extension in VS Code instead of a previous one, which was lately removed due to some unexplained errors. (Note that the previous installation process did not cause major problems!!!).

So I click "Install" (note that the option 'Uninstall' does not actually remove the previous staff, I have to remove directories .espressif and esp_idf manually, which is very annoying, as I can never be sure if all the staff has been removed properly!).

Then I enter ESP_IDF setup: I choose View => Command Pallete => ESP-IDF Configure ISP_IDF extension; I choose version 4.4.5.

I made numerous tries, but they all failed. The latest error I got at the end of the installation was the following:

A system error occurred (spawn C:\Users\<username>\.espressif\python_env\idf5.0_py3.8_env\Scripts\python.exe ENOENT)

My .espressif directory does not contain idf5.0_py3.8_env, it has idf4.4_py3.10_env instead, but I received it in the course of the installation process!

Now when I try to run whatever project starting with 'hello_world' example, I got errors of a kind:

Call Stack (most recent call first):
C:/Users/Samuel/esp/esp-idf/tools/cmake/project.cmake:393 (idf_build_process)
CMakeLists.txt:6 (project)

-- Configuring incomplete, errors occurred!
See also "D:/_FACTORY/ESP_IDF/hello_world/build/CMakeFiles/CMakeOutput.log".

Also when I click on the icon "Device Target", in order to replace esp32 with esp32s3, I fail: no combo with target options appears!

Could anyone please tell me what is wrong in this routine and guide me on how to install Espressif IDF extension flawlessly step by step?

MicroController
Posts: 1705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby MicroController » Tue Aug 15, 2023 11:58 am

Instead of installing IDF via the VS Code extension, you can try to first install IDF manually and then configure the extension to use the existing IDF installation.

samTPL
Posts: 11
Joined: Thu Jun 29, 2023 2:55 pm

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby samTPL » Tue Aug 15, 2023 4:10 pm

Hi, guys, thanks for your quick reaction.

I have manually deleted all the previous staff (both esp and .espressif). Then following your suggestions
1) I took version 4.4 from this place:
https://github.com/espressif/esp-idf

and extracted it here:
C:\<user>\esp\esp-idf

2) then I downloaded ESP-IDF Windows Installer "Universal Online Installer 2.22"
from this place:
https://dl.espressif.com/dl/esp-idf/?idf=4.4

- and run the Installer, choosing version 4.4 again.

As a result, I received a directory C:\<user>\.espressif containing only 2 folders:
dist, tools
and the file esp_idf.json. The resulting directory .espressif is obviously incomplete!

Also, a compiler xtensa-esp32-elf-gcc is not found in
C:\<user>\.espressif\tools\xtensa-esp32s3-elf\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\bin,
and building the project fails.

so I am stuck again and do not know how to proceed. What should be done now in ESP-IDF extension for VScode?

Could you please provide me with step-by-step instructions? Thanks in advance.

MicroController
Posts: 1705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby MicroController » Tue Aug 15, 2023 4:52 pm

samTPL wrote:
Tue Aug 15, 2023 4:10 pm
1) I took version 4.4 from this place:
https://github.com/espressif/esp-idf

and extracted it here:
C:\<user>\esp\esp-idf
Good start... ;-)
2) then I downloaded ESP-IDF Windows Installer "Universal Online Installer 2.22"
from this place:
https://dl.espressif.com/dl/esp-idf/?idf=4.4

- and run the Installer, choosing version 4.4 again.
With the IDF already cloned/extracted, that's not necessary.
After cloning, you should just run "install.sh" or "install.bat" in the IDF directory to have things set up for you in that specific installation.

Once that's sorted out, in VS Code you can F1 + ">ESP-IDF: Configure ESP-IDF extension" and select "use existing setup" to point it to your installation.

samTPL
Posts: 11
Joined: Thu Jun 29, 2023 2:55 pm

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby samTPL » Wed Aug 16, 2023 11:18 am

Thank you,

Following your suggestions I ran install.bat from C:\<user>\esp\esp-idf. which created C:\Espressif directory (instead of a previous .espressive).

This one contains directories 'dist', 'python_env', 'tools' and a file idf-env.json and still seems to be incomplete.

Then I ran 'export.bat'. Both batch files produced some error messages, some of errors declared 'fatal' (please see attachments).

Then in VS Code I selected 'Use Existing Setup' - and it ended up with errors too.

Eventually, the project building process ends up with the message:
-- Configuring incomplete, errors occurred!

Indeed, the ESP_IDF installation process doesn't seem user-friendly enough! Do I have any chance to finish it successfully?
What am I doing wrong???
Attachments
idf_setup_output.txt
(62.28 KiB) Downloaded 466 times
export_bat_output.txt
(1.37 KiB) Downloaded 435 times
install_bat_output.txt
(18.62 KiB) Downloaded 520 times

MicroController
Posts: 1705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby MicroController » Wed Aug 16, 2023 1:41 pm

install.bat and export.bat output look ok.

There may be some path/version issues which prevent the VS Code extension from working properly.

Suggestion:
Try if you can build a project from the command line, i.e. open command line, run IDF's export.bat in it, cd into a project directory and run idf.py build.
If that works, at least the IDF is operational and the problem is isolated to VS Code (configuration).

samTPL
Posts: 11
Joined: Thu Jun 29, 2023 2:55 pm

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby samTPL » Wed Aug 16, 2023 2:57 pm

I did as you suggested.
Here is the result:

D:\_FACTORY\ESP_IDF\hello_world>idf.py build
'idf.py' is not recognized as an internal or external command,
operable program or batch file.

Also, I have noticed that export.bat does not modify the PATH, I have to add the path to xtensa-esp32-elf manually.
Most amazing is that the first installation process went smoothly... so sad...

MicroController
Posts: 1705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby MicroController » Wed Aug 16, 2023 9:15 pm

samTPL wrote:
Wed Aug 16, 2023 2:57 pm
I did as you suggested.
Here is the result:

D:\_FACTORY\ESP_IDF\hello_world>idf.py build
'idf.py' is not recognized as an internal or external command,
operable program or batch file.
That seems odd. Note that you need to run export.bat in the same terminal/command line window in which you then run idf.py.
export.bat does not set the persistent/system-wide PATH but only the PATH in the command line window it is run in.

samTPL
Posts: 11
Joined: Thu Jun 29, 2023 2:55 pm

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby samTPL » Thu Aug 17, 2023 1:37 pm

Thank you, due to your suggestions I have achieved a certain progress.

First, I took the version 4.4.4 instead of 4.4. (!!!) and re-created folder Espressif running install.bat from this (4.4.4) folder.

Finally, I ran C:\Users\<user>\esp_4_4\esp-idf\export.bat (from the project directory, as you suggested!),
and then:
idf.py set-target esp32s3 (this is my board)
idf.py build
idf.py flash COM3

And this way it works!!!

But I still cannot use my VSCode. While configuring ISP-IDF in VSCode I get errors of a kind:
************
c:\Espressif\tools\idf-python\3.11.2\python.exe: No module named virtualenv

File "subprocess.py", line 413, in check_call
subprocess.CalledProcessError: Command '['c:\\Espressif\\tools\\idf-python\\3.11.2\\python.exe', '-m', 'virtualenv', '--python', 'c:\\Espressif\\tools\\idf-python\\3.11.2\\python.exe', '--seeder', 'pip', 'c:\\Espressif\\python_env\\idf4.4_py3.11_env']' returned non-zero exit status 1.
***********
please see the attached file.

What is missing in the directory Espressif, and how do I have to upgrade it and make my VSCode ESP-IDF extension operable again?
Attachments
vscode_output.txt
(78.51 KiB) Downloaded 642 times

MicroController
Posts: 1705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Fail to re-install and configure Espressif IDF extension in VSCode

Postby MicroController » Thu Aug 17, 2023 2:51 pm

Good, so the IDF itself is working now :)
There seem to be some issues left wrt. PATHs and python versions/installations...
Can you try to run vscode.exe from the command line window after running export.bat? This way, vscode may be able to pick up the same path(s)/pythons the IDF does.

Who is online

Users browsing this forum: No registered users and 60 guests