Page 1 of 1

Python issues when setting up VS Code

Posted: Mon Dec 28, 2020 1:38 pm
by espdorian
With a working ESP-IDF setup I started to setup VS Code. I run VS Code from ESP-IDF command prompt, which means the environment should be ok.
Plugin configuration failed on Python dependencies, I ran install.bat, it didn't help. I copied the command and ran it from IDF command shell to see what was happening. It reports 'pyparsing' version too low, but when calling pip info it shows a different version, so somehow it mixes with another environment.

I do not have much Python experience, what might be wrong here ?
H:\.espressif\python_env\Scripts>python.exe "h:\projects\esp\esp-idf\esp-idf\tools\check_python_dependencies.py" -r "h:\projects\esp\esp-idf\esp-idf\requirements.txt"

The following Python requirements are not satisfied:
pyparsing>=2.0.3,<2.4.0
esp-windows-curses; sys_platform == 'win32'
To install the missing packages, please run "H:\projects\esp\esp-idf\install.bat"

H:\.espressif\python_env\Scripts>pip show pyparsing
Name: pyparsing
Version: 2.4.7
Summary: Python parsing module
.....
Location: h:\.espressif\python_env\lib\site-packages
.....
The relevant environments vars are as follows:

IDF_PYTHON_DIR=C:\Python36\
IDF_PYTHON_ENV_PATH=H:\.espressif\python_env\idf4.1_py3.6_env
IDF_TOOLS_PATH=H:\.espressif

Re: Python issues when setting up VS Code

Posted: Mon Dec 28, 2020 2:32 pm
by espdorian
I overlooked that the version was too high, so for pyparsing it is solved. Still remains a similar issue with curses:
Successfully built esp-windows-curses
Installing collected packages: esp-windows-curses
Attempting uninstall: esp-windows-curses
Found existing installation: esp-windows-curses 0.1
Uninstalling esp-windows-curses-0.1:
Successfully uninstalled esp-windows-curses-0.1
Successfully installed esp-windows-curses-0.1
All done! You can now run:
export.bat
(python_env) H:\projects\esp\esp-idf>python.exe "h:\projects\esp\esp-idf\esp-idf\tools\check_python_dependencies.py" -r "h:\projects\esp\esp-idf\esp-idf\requirements.txt"
The following Python requirements are not satisfied:
esp-windows-curses; sys_platform == 'win32'
To install the missing packages, please run "H:\projects\esp\esp-idf\install.bat"
When I check the folder: .espressif\python_env there are actually two variants of pip and python.exe
.espressif\python_env\idf4.1_py3.6_env\python.exe
.espressif\python_env\scripts\python.exe

When calling .espressif\python_env\idf4.1_py3.6_env\pip it shows curses installed, the other one does not.

What is expected here and which python.exe is expected to be in the IDF_PYTHON_DIR which is currently: C:\Python36\

I expected it to be trivial to configure the ESP plugin, but it seems not :(

Re: Python issues when setting up VS Code

Posted: Tue Dec 29, 2020 7:05 am
by ESP_bignacio
Have you configure the extension using the ESP-IDF: Configure ESP-IDF extension command ?

Steps are explained here : https://github.com/espressif/vscode-esp ... OARDING.md

or check our Youtube video

Re: Python issues when setting up VS Code

Posted: Tue Dec 29, 2020 9:34 am
by espdorian
Yes, but it failed when checking for the required Python libraries. Somehow it mixed 2 Python environments. Finally I completely deleted and re-installed the tools (esp-idf-tools-setup-2.3.exe) after which the problem disappeared.