VS Code CMake not using correct Python ENV

jcarter293
Posts: 2
Joined: Sun Jan 10, 2021 6:47 pm

VS Code CMake not using correct Python ENV

Postby jcarter293 » Sun Jan 10, 2021 6:51 pm

When I run CMake configure I Get this error:
[cmake] Diagnostic information:
[cmake] IDF_PYTHON_ENV_PATH: C:\ESP32\.espressif\python_env\idf4.3_py3.9_env\scripts
[cmake] Python interpreter used: C:\Python\Python39\python.exe
[cmake] Warning: python interpreter not running from IDF_PYTHON_ENV_PATH
I can't figure out why it is not using the correct python.

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

Re: VS Code CMake not using correct Python ENV

Postby ESP_bignacio » Mon Jan 11, 2021 6:47 am

Are you using CMake Tools extension ? Or are you using another extension?

If you are using Microsoft's CMake Tools extension, you might want to set an environment variable called PYTHON with

Code: Select all

C:\ESP32\.espressif\python_env\idf4.3_py3.9_env\Scripts\python.exe
You can also try our official extension for Visual Studio Code here

jcarter293
Posts: 2
Joined: Sun Jan 10, 2021 6:47 pm

Re: VS Code CMake not using correct Python ENV

Postby jcarter293 » Mon Jan 11, 2021 4:34 pm

Ah, I didn't realize that was coming from another extension. I did use the esp-idf extension to install but I think vs code suggested installing cmake tools as well.
I have two more issues:
1. Is after opening the project I get.
Unable to resolve configuration with compilerPath "c:/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe". Using "cl.exe" instead.
The Project builds without issues so I'm not 100% sure what is going on here.
2. Is Opening the monitor fails with
C:\ESP32\Projects\HRV-Main-Control>C:\ESP32\.espressif\python_env\idf4.3_py3.9_env\Scripts\python.exe C:\ESP32\esp-idf\tools\idf.py -p COM3 monitor
Traceback (most recent call last):
File "C:\ESP32\esp-idf\tools\idf.py", line 811, in <module>
main()
File "C:\ESP32\esp-idf\tools\idf.py", line 726, in main
checks_output = check_environment()
File "C:\ESP32\esp-idf\tools\idf.py", line 77, in check_environment
debug_print_idf_version()
File "C:\ESP32\esp-idf\tools\idf.py", line 132, in debug_print_idf_version
version = idf_version()
File "C:\ESP32\esp-idf\tools\idf_py_actions\tools.py", line 56, in idf_version
"--git-dir=%s" % os.path.join(os.environ["IDF_PATH"], '.git'),
File "C:\Python\Python39\lib\os.py", line 679, in __getitem__
raise KeyError(key) from None
KeyError: 'IDF_PATH'

C:\ESP32\Projects\HRV-Main-Control>C:\ESP32\.espressif\python_env\idf4.3_py3.9_env\Scripts\python.exe C:\ESP32\esp-idf\tools\idf.py -p COM3 monitor
Traceback (most recent call last):
File "C:\ESP32\esp-idf\tools\idf.py", line 811, in <module>
main()
File "C:\ESP32\esp-idf\tools\idf.py", line 726, in main
checks_output = check_environment()
File "C:\ESP32\esp-idf\tools\idf.py", line 77, in check_environment
debug_print_idf_version()
File "C:\ESP32\esp-idf\tools\idf.py", line 132, in debug_print_idf_version
version = idf_version()
File "C:\ESP32\esp-idf\tools\idf_py_actions\tools.py", line 56, in idf_version
"--git-dir=%s" % os.path.join(os.environ["IDF_PATH"], '.git'),
File "C:\Python\Python39\lib\os.py", line 679, in __getitem__
raise KeyError(key) from None
KeyError: 'IDF_PATH'
Any help you can provide with these would be awesome!

defiantVatic
Posts: 1
Joined: Tue Jan 19, 2021 6:00 am

Re: VS Code CMake not using correct Python ENV

Postby defiantVatic » Tue Jan 19, 2021 6:19 am

I am also having the same issues any support would be helpful

bkgoodman
Posts: 45
Joined: Fri Feb 17, 2017 12:41 pm

Re: VS Code CMake not using correct Python ENV

Postby bkgoodman » Thu Apr 15, 2021 3:17 pm

I had the same issue - I found the issue was I had the "Python" extension added in VS code. When I (disabled? uninstalled?) it - IDF builds then magically started doing the right thing.

wuming2007
Posts: 1
Joined: Sat Jul 24, 2021 3:42 am

Re: VS Code CMake not using correct Python ENV

Postby wuming2007 » Sat Jul 24, 2021 3:45 am

I have the same issue.
It seems the system add homebrew python in PATH variable and get the python first.

Who is online

Users browsing this forum: No registered users and 31 guests