espressif / vscode-esp-idf-extension

Visual Studio Code extension for ESP-IDF projects
Apache License 2.0
994 stars 292 forks source link

[Bug Report] INVALID ESP-IDF & Git not found even though its present #447

Closed frak0d closed 3 years ago

frak0d commented 3 years ago

Describe the bug :- I installed esp-idf using Windows installer from espressif website. It installed successfully and I am able to use esp-idf in commandline.

The tools exist in proper directories and I can manually run them but this extension isn't detecting them. During setup of esp-idf extension, its saying INVALID ESP-IDF an throws out error saying git not found in current environment.

Then I also tried uninstalling esp-idf and letting the extension download esp-idf itself, still same error. And I even compared the checksum of the esp-idf-v4.3.zip downloaded by extension as well as by windows installer, its same, so my download is not currupt.

Please fix this extension. I have a limited internet and due to this extension and its countless failed downloads i already used up a lot of my data plan and my time.

To Reproduce :-

  1. Install VSCode
  2. Install C/C++ & ESP-IDF Extension
  3. Install esp-idf at custom loctaion

Expected behavior :- I expect it to detect the tools properly.

Screenshots :- image

Environment :-

Logs Obtained via esp-idf doctor command :-

---------------------------------------------- ESP-IDF Extension for Visual Studio Code report ---------------------------------------------
OS win32 x64 10.0.19042 
System environment variable PATH 
 C:\Program Files (x86)\Python39-32\Scripts\;C:\Program Files (x86)\Python39-32\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Python38\Scripts\;C:\Program Files\Python38\;C:\Program Files (x86)\Python38-32\Scripts\;C:\Program Files (x86)\Python38-32\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\TDM-GCC-64\bin;C:\Program Files\CMake\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\UPX GUI\UPX;C:\Users\Tanishq Banyal\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\GitHub CLI\;G:\vcpkg; 
Visual Studio Code version 1.57.1 
Visual Studio Code language en 
Visual Studio Code shell C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 
ESP-IDF Extension version 1.1.0 
---------------------------------------------------- Extension configuration settings ------------------------------------------------------
ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH}
ESP-IDF Path (idf.espIdfPath) c:\Users\Tanishq Banyal\.espressif\esp-idf
ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH}
Custom extra paths (idf.customExtraPaths) C:\Users\Tanishq Banyal\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin;C:\Users\Tanishq Banyal\.espressif\tools\xtensa-esp32s2-elf\esp-2020r3-8.4.0\xtensa-esp32s2-elf\bin;C:\Users\Tanishq Banyal\.espressif\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin;C:\Users\Tanishq Banyal\.espressif\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin;C:\Users\Tanishq Banyal\.espressif\tools\cmake\3.16.4\bin;C:\Users\Tanishq Banyal\.espressif\tools\openocd-esp32\v0.10.0-esp32-20200709\openocd-esp32\bin;C:\Users\Tanishq Banyal\.espressif\tools\ninja\1.10.0;C:\Users\Tanishq Banyal\.espressif\tools\idf-exe\1.0.1;C:\Users\Tanishq Banyal\.espressif\tools\ccache\3.7;C:\Users\Tanishq Banyal\.espressif\tools\dfu-util\0.9\dfu-util-0.9-win64
Custom extra vars (idf.customExtraVars) {}
Virtual env Python Path (idf.pythonBinPath) c:\Users\Tanishq Banyal\.espressif\tools\python_env\idf4.2_py3.9_env\Scripts\python.exe
Serial port (idf.port) COM1
OpenOCD Configs (idf.openOcdConfigs) interface/ftdi/esp32_devkitj_v1.cfg,board/esp32-wrover.cfg
ESP-IDF Tools Path (idf.toolsPath) ${env:IDF_TOOLS_PATH}
Git Path (idf.gitPath) G:\.espressif\tools\idf-git\cmd\git.exe
-------------------------------------------------------- Configurations access -------------------------------------------------------------
Access to ESP-ADF Path (idf.espIdfPath) false
Access to ESP-IDF Path (idf.espIdfPath) false
Access to ESP-MDF Path (idf.espIdfPath) false
Access to ESP-IDF Custom extra paths
Access to C:\Users\Tanishq Banyal\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\xtensa-esp32s2-elf\esp-2020r3-8.4.0\xtensa-esp32s2-elf\bin: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\esp32ulp-elf\2.28.51-esp-20191205\esp32ulp-elf-binutils\bin: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\esp32s2ulp-elf\2.28.51-esp-20191205\esp32s2ulp-elf-binutils\bin: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\cmake\3.16.4\bin: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\openocd-esp32\v0.10.0-esp32-20200709\openocd-esp32\bin: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\ninja\1.10.0: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\idf-exe\1.0.1: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\ccache\3.7: false
Access to C:\Users\Tanishq Banyal\.espressif\tools\dfu-util\0.9\dfu-util-0.9-win64: false
Access to Virtual env Python Path (idf.pythonBinPath) false
Access to CMake in environment PATH undefined
Access to Ninja in environment PATH undefined
Access to ESP-IDF Tools Path (idf.toolsPath) false
----------------------------------------------------------- Executables Versions -----------------------------------------------------------
Git version undefined
ESP-IDF version undefined
Python version undefined
Python's pip version undefined
-------------------------------------------------- Python packages in idf.pythonBinPath ----------------------------------------------------
---------------------------------------------------- Check ESP-IDF python requirements.txt -------------------------------------------------
Check ESP-IDF Python packages undefined
---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------
Check Extension Python packages undefined
---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------
Check Debug AdapterPython packages undefined
----------------------------------------------------------- Latest error -----------------------------------------------------------------
Latest error at Command failed: G:\.espressif\tools\idf-git\cmd\git.exe --version
The system cannot find the path specified.

--------------------------------------------------------------------------------------------------------------------------------------------

Extension Configuration settings :- (all of these are wrong paths, so I also tried with correct paths, still same result)

    "idf.espIdfPathWin": "c:\\Users\\Tanishq Banyal\\.espressif\\esp-idf",
    "idf.pythonBinPathWin": "c:\\Users\\Tanishq Banyal\\.espressif\\tools\\python_env\\idf4.2_py3.9_env\\Scripts\\python.exe",
    "idf.customExtraPaths": "C:\\Users\\Tanishq Banyal\\.espressif\\tools\\xtensa-esp32-elf\\esp-2020r3-8.4.0\\xtensa-esp32-elf\\bin;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\xtensa-esp32s2-elf\\esp-2020r3-8.4.0\\xtensa-esp32s2-elf\\bin;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\esp32ulp-elf\\2.28.51-esp-20191205\\esp32ulp-elf-binutils\\bin;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\esp32s2ulp-elf\\2.28.51-esp-20191205\\esp32s2ulp-elf-binutils\\bin;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\cmake\\3.16.4\\bin;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\openocd-esp32\\v0.10.0-esp32-20200709\\openocd-esp32\\bin;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\ninja\\1.10.0;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\idf-exe\\1.0.1;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\ccache\\3.7;C:\\Users\\Tanishq Banyal\\.espressif\\tools\\dfu-util\\0.9\\dfu-util-0.9-win64",
    "idf.customExtraVars": "{}",
    "workbench.startupEditor": "newUntitledFile"

Additional context :-

444 may fix this issue.

EDIT :-

I created a fork and merged #444 to it. then i created .vsix package using github workflow & installed it.

After some manual config in settings.json (because the web interface wasnt working), It works now !! (except that i am unable to change port)

444 SHOULD BE FIXED AND MERGED ASAP 🙏

samsam4 commented 3 years ago

I have similar issue and the workarounds are either to add path to git and python in the Windows environment Path, or install VSC extension from this .vsix file from here: https://github.com/espressif/vscode-esp-idf-extension/issues/434#issuecomment-869739163

(Just make sure not to try some of the previous versions posted in the same thread as they don't work) :(

frak0d commented 3 years ago

I have similar issue and the workarounds are either to add path to git and python in the Windows environment Path

Latest Git and python are already in path, but in idf logs it says git is incompatible so it's going to download again.

Btw merging #444 and building a vsix works too.

Except now my problem is that I am unable to change port, it's defaulting to COM1, and COM1 is not physically accessible on my PC :(

samsam4 commented 3 years ago

@Tanishq-Banyal This is the same .vsix I gave you the link before - just be sure you get the last one (from 28-6-21) as there were couple tries before that didn't fix the issue :(. I used offline installer v2.8 with IDF 4.2.1 selected and with the latest .vsix now working and I dont need to pollute Windows Path with the git and python :) Still didn't make thorough test, but at least this obstacle I think is fixed :) Regarding duplicate downloading git and python - you can refer to the same link I gave you before, but my very first posting: bugs1 to 4, but I think this issue was fixed with some of the first .vsix brianignacio5 posted in the same thread (which are actually from fix idf git python setup #444)

brianignacio5 commented 3 years ago

To change ports you can use the ESP-IDF: Select port to use command or change idf.portWin in the Visual Studio Code User/Workspace/Workspace Folder configuration settings

frak0d commented 3 years ago

To change ports you can use the ESP-IDF: Select port to use command or change idf.portWin in the Visual Studio Code User/Workspace/Workspace Folder configuration settings

I have already tried both ways. Even though I can see port is COM3 in settings file, but it still uses COM1 (which is not physically accessible on my PC)

I suspect this happened due to some bug in #444 (I am using master branch of extension merged with #444 in vscode)

brianignacio5 commented 3 years ago

There is a configuration setting called idf.saveScope or Idf: Save Scope to choose where to save configuration settings and its default is User or Global settings. This is used by the extension to know where to save settings.

Maybe there is a setting in your <project directory>/.vscode/settings.json with idf.portWin that is overriding your User settings. Please take a look at vscode settings precedence

frak0d commented 3 years ago

Maybe there is a setting in your <project directory>/.vscode/settings.json with idf.portWin that is overriding your User settings. Please take a look at vscode settings precedence

Thanks, that worked, didnt knew that there were 2 settings.json (one global and one per project)

ideapad2009 commented 2 years ago

I have the same problem but I have solved. My finding is that esp-idf-tool can not be installed in folder whose name has space such as Program Files folder.