ESP-IDF Installation of Ubuntu 22.04LTS with VSCode repeatedly failing

whoeverzoo
Posts: 1
Joined: Wed Oct 25, 2023 5:39 pm

ESP-IDF Installation of Ubuntu 22.04LTS with VSCode repeatedly failing

Postby whoeverzoo » Tue Feb 13, 2024 7:23 pm

I've gone through the install process of ESP-IDF at least 5 times this week, not including the 15 other times I've attempted it in the last few months. Suffice it to say that it's been quite frustrating not being able to get it to work. I'll go through the process I take installing it to see if anything I'm doing is amiss.

I'll start that I think the issue is with the system python. Since the newest major debian release, the default system python is no longer used, and the user is forced to use pyenv. This seems to cause all sorts of issues with ESP-IDF and the python based tools.

System information

Code: Select all

# OS version
Ubuntu 22.04.3 LTS
# system python version
$ /usr/bin/python3 --version
Python 3.10.12
# global python pyenv
3.11.7/envs/primary
1. Delete existing installation (wipe ~/.espressif and ~/Documents/esp/)
2. Install through vscode, selecting advanced installation and my desired installation folders (~/.espressif and ~/Documents/esp/)
3. Installation finishes. Close and open vscode.
4. Try to do anything, it fails (tools not in path)
by the way, does anyone know of a way to source the esp-idf environment on vscode startup? the way I used to do it stopped working a long time ago
5. source esp-idf environment

Code: Select all

Detecting the Python interpreter
Checking "python3" ...
Python 3.11.7
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Not using an unsupported version of tool ninja found in PATH: 1.10.1. To use it, run '/home/user/.pyenv/versions/primary/bin/python3 /home/user/Documents/esp/esp-idf/tools/idf_tools.py export --prefer-system'
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
ERROR: /home/user/.espressif/python_env/idf5.1_py3.11_env/bin/python doesn't exist! Please run the install script or "idf_tools.py install-python-env" in order to create it
6. Try to run idf.py

Code: Select all

$ idf.py
Cannot import module "click". This usually means that "idf.py" was not spawned within an ESP-IDF shell environment or the python virtual environment used by "idf.py" is corrupted.
Please use idf.py only in an ESP-IDF shell environment. If problem persists, please try to install ESP-IDF tools again as described in the Get Started guide.
Then, some debugging:

Code: Select all

$ pyenv version
primary (set by /home/user/.pyenv/version)
$ python --version
Python 3.11.7

7. Try installing python env. No matter how many times I do this, it regularly finds new things to install, but usually finishes without errors.

Code: Select all

$ /usr/bin/python3 /home/jmux/Documents/esp/esp-idf/tools/idf_tools.py install-python-env
Python 3.10.12
pip 24.0 from /home/user/.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages/pip (python 3.10)
Upgrading pip and setuptools...
Requirement already satisfied: pip in ./.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages (24.0)
Requirement already satisfied: setuptools in ./.espressif/python_env/idf5.1_py3.10_env/lib/python3.10/site-packages (69.1.0)
Downloading https://dl.espressif.com/dl/esp-idf/espidf.constraints.v5.1.txt
Destination: /home/user/.espressif/espidf.constraints.v5.1.txt.tmp
Done
Installing Python packages
 Constraint file: /home/user/.espressif/espidf.constraints.v5.1.txt
 Requirement files:
8. Try running idf.py again. Fails with same response in 6.
Try running idf.py in vscode terminal. ENV isn't sourced, source it, same response as in 6. Clicking the compile button (sometimes) works though, not sure why that is.

I'm at my wits end, I'm not sure what else to try. Why is installing the SDK so impossible on what should be the most-supported distribution?

This also isn't even touching the fact that intellisense highlighting in vscode is nearly permanently broken, and other than manually including every possible directory the standard sdk libraries always show red squiggles.

How can I either 1) force ESP-IDF to use a normal pyenv venv that I can manage normally to avoid this headache or 2) get it to actually work with the one it's supposed to come with?

Thanks.

User avatar
ESP_Roland
Posts: 265
Joined: Tue Oct 09, 2018 10:28 am

Re: ESP-IDF Installation of Ubuntu 22.04LTS with VSCode repeatedly failing

Postby ESP_Roland » Wed Feb 14, 2024 7:22 am

You can see in your logs that you are forcing it to use the system Python and you are installing things to this directory:

Code: Select all

/home/user/.espressif/python_env/idf5.1_py3.10_env
And when you are sourcing the environment then it is looking for the following directory:

Code: Select all

/home/user/.espressif/python_env/idf5.1_py3.11_env
You should use the pyenv python to install tools to solve this issue.

The above is just from the point of view of pure ESP-IDF.

Which Python is used by the environment in Vscode? You can see it from the error output. And you can fix it manually using that Python.

I'm not an expert on the Vscode pluging. I'd recommend to open an issue at https://github.com/espressif/vscode-esp ... ion/issues to get better help if the above is not helpful for you.

Who is online

Users browsing this forum: No registered users and 83 guests