ESP-IDF vscode extension wrong python path problem

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

ESP-IDF vscode extension wrong python path problem

Postby zazas321 » Mon Apr 26, 2021 6:51 am

Hello. I am installing ESP-IDF extension on my vscode and getting some problems with python path. I have installed a fresh latest python to the location:

Code: Select all

C:\Users\Lukas\AppData\Local\Programs\Python\Python39
When I try to install esp-idf, I get command failed error:

Code: Select all

Command failed: "C:\Users\Lukas\.espressif\python_env\idf4.2_py3.9_env\Scripts\python.exe" -m pip install --no-warn-script-location  -r "c:\Users\Lukas\.vscode\extensions\espressif.esp-idf-extension-1.0.2\requirements.txt"
No Python at 'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe'

And the output monitor shows:

Code: Select all

Installing package Toolchain for Xtensa (ESP32) based on GCC
Installing zip package Toolchain for Xtensa (ESP32) based on GCC
Installing package Toolchain for Xtensa (ESP32-S2) based on GCC
Installing zip package Toolchain for Xtensa (ESP32-S2) based on GCC
Installing package Toolchain for ESP32 ULP coprocessor
Installing zip package Toolchain for ESP32 ULP coprocessor
Installing package Toolchain for ESP32-S2 ULP coprocessor
Installing zip package Toolchain for ESP32-S2 ULP coprocessor
Installing package CMake build system
Installing zip package CMake build system
Installing package OpenOCD for ESP32
Installing zip package OpenOCD for ESP32
Installing package Ninja build system
Installing zip package Ninja build system
Installing package IDF wrapper tool for Windows
Installing zip package IDF wrapper tool for Windows
Installing package Ccache (compiler cache)
Installing zip package Ccache (compiler cache)
Installing package dfu-util (Device Firmware Upgrade Utilities)
Installing zip package dfu-util (Device Firmware Upgrade Utilities)

Installing ESP-IDF extension python packages in C:\Users\Lukas\.espressif\python_env\idf4.2_py3.9_env\Scripts\python.exe ...


No Python at 'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe'
Command failed: "C:\Users\Lukas\.espressif\python_env\idf4.2_py3.9_env\Scripts\python.exe" -m pip install --no-warn-script-location  -r "c:\Users\Lukas\.vscode\extensions\espressif.esp-idf-extension-1.0.2\requirements.txt"
No Python at 'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe'
Command failed: "C:\Users\Lukas\.espressif\python_env\idf4.2_py3.9_env\Scripts\python.exe" -m pip install --no-warn-script-location  -r "c:\Users\Lukas\.vscode\extensions\espressif.esp-idf-extension-1.0.2\requirements.txt"
No Python at 'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe'


It seems like it is looking for python in :

Code: Select all

'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9
Which is a different location to where I have installed my python.


I have double checked the python location that is set for the esp-idf installation and it is set to the correct location:

Code: Select all

C:\Users\Lukas\AppData\Local\Programs\Python\Python39\python.exe
https://ibb.co/ZGKdYMW


I have also checked the settings.json file and the path also seems correct

Code: Select all

{
    "idf.espIdfPathWin": "C:\\Users\\Lukas\\esp\\esp-idf",
    "idf.pythonBinPathWin": "C:\\Users\\Lukas\\.espressif\\python_env\\idf4.2_py3.9_env\\Scripts\\python.exe",
    "idf.customExtraPaths": "C:\\Users\\Lukas\\.espressif\\tools\\xtensa-esp32-elf\\esp-2020r3-8.4.0\\xtensa-esp32-elf\\bin;C:\\Users\\Lukas\\.espressif\\tools\\xtensa-esp32s2-elf\\esp-2020r3-8.4.0\\xtensa-esp32s2-elf\\bin;C:\\Users\\Lukas\\.espressif\\tools\\esp32ulp-elf\\2.28.51-esp-20191205\\esp32ulp-elf-binutils\\bin;C:\\Users\\Lukas\\.espressif\\tools\\esp32s2ulp-elf\\2.28.51-esp-20191205\\esp32s2ulp-elf-binutils\\bin;C:\\Users\\Lukas\\.espressif\\tools\\cmake\\3.16.4\\bin;C:\\Users\\Lukas\\.espressif\\tools\\openocd-esp32\\v0.10.0-esp32-20200709\\openocd-esp32\\bin;C:\\Users\\Lukas\\.espressif\\tools\\ninja\\1.10.0;C:\\Users\\Lukas\\.espressif\\tools\\idf-exe\\1.0.1;C:\\Users\\Lukas\\.espressif\\tools\\ccache\\3.7;C:\\Users\\Lukas\\.espressif\\tools\\dfu-util\\0.9\\dfu-util-0.9-win64",
    "idf.customExtraVars": "{\"OPENOCD_SCRIPTS\":\"C:\\\\Users\\\\Lukas\\\\.espressif\\\\tools\\\\openocd-esp32\\\\v0.10.0-esp32-20200709/openocd-esp32/share/openocd/scripts\",\"IDF_CCACHE_ENABLE\":\"1\"}",
    "workbench.iconTheme": "vscode-icons",
    "workbench.editor.untitled.hint": "hidden",
    "workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb",
            "filenamePattern": "*.ipynb"
        }
    ],
    "python.pythonPath": "C:\\Users\\Lukas\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
    "idf.openOcdConfigs": [
        
        "interface/ftdi/esp32_devkitj_v1.cfg",
        "board/esp32-wrover.cfg"
    ]
}

Appreciate any help.

ESP_bignacio
Posts: 214
Joined: Wed May 02, 2018 12:12 pm

Re: ESP-IDF vscode extension wrong python path problem

Postby ESP_bignacio » Mon Apr 26, 2021 1:36 pm

What is the content of your system environment PATH ?

Are you running the extension setup in Visual Studio Code with an open directory that has a `.vscode/settings.json` ? It could be overriding the values in your global settings.

Was C:\Users\Lukas\.espressif\python_env\idf4.2_py3.9_env\Scripts\python.exe created with C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe ? Virtual environments are not completely stand alone as discussed here

Maybe delete this virtual environment entirely and run the extension setup again.

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: ESP-IDF vscode extension wrong python path problem

Postby zazas321 » Tue Apr 27, 2021 4:24 am

Hello. Thanks for the response. Please could you clarify what you mean because I do not understand...

I simply downloaded Python from here:
https://www.python.org/downloads/

And during the installation setup it said that it is going to install Python in the following directory:

Code: Select all

C:\Users\Lukas\AppData\Local\Programs\Python\Python39

I have tried to reinstall Python, as well as reinstalling esp-idf extension - the issue still persists.

I do not have directory opened .vscode/settings.json when I am running my vs code.


How do I check my environment PATHS and how do I fix them for python?

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: ESP-IDF vscode extension wrong python path problem

Postby zazas321 » Tue Apr 27, 2021 4:32 am

I have followed these simple steps to check my PATH variables (Found the steps on https://java.com/en/download/help/path.html ) :


Windows
Windows 10 and Windows 8

1.In Search, search for and then select: System (Control Panel)
2.Click the Advanced system settings link.
3.Click Environment Variables. In the section System Variables find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
4.In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
5.Reopen Command prompt window, and run your java code.


My environment path looks like ( Adding a screenshot below):
https://ibb.co/wWcbfp4


From what I have been able to discover, this path with Microsoft/windowsapps is default when you download the Python from the Windows Microsoft store. Perhaps I had done it years ago. Now, I have installed it from the official Python website.. I am new to all these environment PATHS and dont realy understand how they work. Do I need to manually add the path of my python there?

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: ESP-IDF vscode extension wrong python path problem

Postby zazas321 » Tue Apr 27, 2021 4:46 am

I have added a Path to user environment variables:
https://ibb.co/PjHcLkF

And proceeded with reinstalling the esp-idf, unfortunately, same issue persists:

Code: Select all

Installing ESP-IDF extension python packages in C:\Users\Lukas\.espressif\python_env\idf4.2_py3.9_env\Scripts\python.exe ...


No Python at 'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe'
Command failed: "C:\Users\Lukas\.espressif\python_env\idf4.2_py3.9_env\Scripts\python.exe" -m pip install --no-warn-script-location  -r "c:\Users\Lukas\.vscode\extensions\espressif.esp-idf-extension-1.0.2\requirements.txt"
No Python at 'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe'
Command failed: "C:\Users\Lukas\.espressif\python_env\idf4.2_py3.9_env\Scripts\python.exe" -m pip install --no-warn-script-location  -r "c:\Users\Lukas\.vscode\extensions\espressif.esp-idf-extension-1.0.2\requirements.txt"
No Python at 'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe'

I really dont know how to debug this issue as I do not know how this extension determines where to look for python. Why does it think that my python should be located at No Python at 'C:\Users\Lukas\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation ? Is this destination set somewhere in my VSCode settings or esp-idf settings? How do I clear this destination

Baldhead
Posts: 434
Joined: Sun Mar 31, 2019 5:16 am

Re: ESP-IDF vscode extension wrong python path problem

Postby Baldhead » Wed Nov 22, 2023 10:22 pm

Hi @zazas321,

You solve your problem ?

I have a similar problem at: viewtopic.php?f=40&t=36951

Who is online

Users browsing this forum: No registered users and 20 guests