Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'idfSelectedId' (IDFGH-8367) #9837

Closed
3 tasks done
jdjingdian opened this issue Sep 23, 2022 · 17 comments
Closed
3 tasks done

KeyError: 'idfSelectedId' (IDFGH-8367) #9837

jdjingdian opened this issue Sep 23, 2022 · 17 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@jdjingdian
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v4.3.4

Operating System used.

macOS

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

No response

What is the expected behavior?

install all the dependency

What is the actual behavior?

KeyError: 'idfSelectedId'

Steps to reproduce.

  1. macOS Ventura with Python3 download from python.org
  2. git clone -b v4.3.4 --recursive https://github.com/espressif/esp-idf.git esp-idf-v4.3.4
  3. cd esp-idf-v4.3.4
  4. ./install.sh

Build or installation Logs.

`magicdian@jingdiandeMBP esp-idf-v4.3.4 % ./install.sh 
Detecting the Python interpreter
Checking "python" ...
/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/detect_python.sh: line 16: python: command not found
Checking "python3" ...
Python 3.10.6
"python3" has been detected
Installing ESP-IDF tools
Traceback (most recent call last):
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1852, in <module>
    main(sys.argv[1:])
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1848, in main
    action_func(args)
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1415, in action_install
    targets = clean_targets(args.targets)
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1078, in clean_targets
    export_targets_to_idf_env_json(targets_from_tools_json)
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1046, in export_targets_to_idf_env_json
    targets = list(set(targets + get_user_defined_targets()))
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1092, in get_user_defined_targets
    if env == idf_env_json['idfSelectedId']:
KeyError: 'idfSelectedId'`

More Information.

No response

@jdjingdian jdjingdian added the Type: Bug bugs in IDF label Sep 23, 2022
@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 23, 2022
@github-actions github-actions bot changed the title KeyError: 'idfSelectedId' KeyError: 'idfSelectedId' (IDFGH-8367) Sep 23, 2022
@dobairoland
Copy link
Collaborator

Hi @jdjingdian. Thanks for the report. May I ask you that have you run recently the install script for the master branch before switching to v4.3.4?

Could you please share your ~/.espressif/idf-env.json file?

@jdjingdian
Copy link
Author

Hi @jdjingdian. Thanks for the report. May I ask you that have you run recently the install script for the master branch before switching to v4.3.4?

Could you please share your ~/.espressif/idf-env.json file?

I guess I clone the master branch and run the install.sh, then clone v4.3.4 in other folders(~/esp-idf-v4.3.4).

magicdian@jingdiandeMBP esp-idf-v4.3.4 % cat ~/.espressif/idf-env.json { "idfInstalled": { "/Users/magicdian/Documents/VSCODE/esp-idf-v5.1": { "version": "5.1", "path": "/Users/magicdian/Documents/VSCODE/esp-idf", "features": [ "core" ], "targets": [ "esp32c2", "esp32c6", "esp32c3", "esp32s2", "esp32", "esp32s3", "esp32h2" ] } } }

@jdjingdian
Copy link
Author

just deleted the ~/.espressif folder, install.sh works! Thanks!

@dobairoland
Copy link
Collaborator

Thanks. We will fix this soon. This will be closed by commit with a proper and permanent fix.

@AxelLin
Copy link
Contributor

AxelLin commented Sep 23, 2022

I also hit this issue with v4.3.4-50-ge40b55e854 .
And the same issue in v4.4.2-153-g2bce0a19f6 .

@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally and removed Status: Opened Issue is new labels Sep 27, 2022
antmak pushed a commit to antmak/dev-idf that referenced this issue Sep 28, 2022
@AxelLin
Copy link
Contributor

AxelLin commented Sep 28, 2022

@dobairoland Hope to get the fix for v4.3 soon, I cannot build with v4.3 for several days.

@dobairoland
Copy link
Collaborator

@AxelLin You don't have to wait for any fix. Just remove ~/.espressif/idf-env.json and re-run the install script.

I also hit this issue with v4.3.4-50-ge40b55e854 .
And the same issue in v4.4.2-153-g2bce0a19f6 .

The issue is in the master branch. Switching from there to any of these release branches causes the issue. The proper fix will arrive soon to all branches. Until then, the above workaround can be used.

@dobairoland
Copy link
Collaborator

Fixes are now in the release branches.

@zzzh
Copy link

zzzh commented Oct 14, 2022

I think it's a python virtual environment issue.

How I got this error:

  1. clone the master branch, and run install.py
  2. checkout a stable branch and do submodule update
  3. run idf.sh --version --> this error come out with complains of many python packages mismatch info...
  4. then, even get_idf have same error and can't continue.

So, is there a quick way to switch to a new idf version of python virtual environment?
For example, how to switch from idf5.1_py3.8_env to idf4.2_py3.8_env?

@gojimmypi
Copy link
Contributor

Heads up I encountered this problem today with Espressif ESP-IDF v5 running from a VisualGDB install. Broke my ability to run the VisualGDB directory of ESP-IDF for all versions. See sysprogs forum.

The solution from @jdjingdian worked for me:

just deleted the ~/.espressif folder

@dobairoland
Copy link
Collaborator

I believe so that the issue has been fixed if you are using an ESP-IDF with the linked patch included.

just deleted the ~/.espressif folder

In case some of you still looking for a workaround, please be aware that removing ~/.espressif/idf-env.json is enough. If you remove the whole directory then all toolchains will have to be downloaded again. You don't want that if you have slow Internet connection.

@gojimmypi
Copy link
Contributor

Thanks for the tip re delete file vs directory.

I noticed that there was a new ESP-IDF offline installer released just an hour ago:

https://github.com/espressif/idf-installer/releases/tag/offline-5.0

Does this contain the fix regarding idf-env.json?

ebisuke pushed a commit to ebisuke/esp-idf that referenced this issue Jan 7, 2023
ebisuke pushed a commit to ebisuke/esp-idf that referenced this issue Jan 7, 2023
ebisuke pushed a commit to ebisuke/esp-idf that referenced this issue Jan 8, 2023
ebisuke pushed a commit to ebisuke/esp-idf that referenced this issue Jan 8, 2023
ebisuke pushed a commit to ebisuke/esp-idf that referenced this issue Jan 8, 2023
ebisuke pushed a commit to ebisuke/esp-idf that referenced this issue Jan 8, 2023
@Prathamesh08glovatrix
Copy link

~/.espressif
can anyone please tell me where exactly this folder is located in Apple mackboom M1?

@mfialaf
Copy link
Collaborator

mfialaf commented Jan 19, 2023

@radimkarnis Can you please help?

~/.espressif can anyone please tell me where exactly this folder is located in Apple mackboom M1?

@gojimmypi
Copy link
Contributor

gojimmypi commented Jan 19, 2023

@Prathamesh08glovatrix does the Mac have an equivalent ESP-IDF environment variable that contains your folder location?

I don't have one to test, but a Mac is a bit Linux-like, no? Perhaps echo $IDF_PATH or first cd $IDF_PATH and then pwd?

  • edit: correction to IDF_PATH environment variable name

@radimkarnis
Copy link
Collaborator

@Prathamesh08glovatrix it's /Users/<yourusername>/.espressif/idf-env.json. Running the rm ~/.espressif/idf-env.json command should be enough.

@Prathamesh08glovatrix
Copy link

@radimkarnis thanks bro its gets install perfectly. love u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

9 participants