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

Cannot run install.ps1: Invalid argument (IDFGH-12090) #13148

Closed
3 tasks done
xobs opened this issue Feb 9, 2024 · 4 comments
Closed
3 tasks done

Cannot run install.ps1: Invalid argument (IDFGH-12090) #13148

xobs opened this issue Feb 9, 2024 · 4 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@xobs
Copy link
Contributor

xobs commented Feb 9, 2024

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.

v5.3-dev-1978-g4fb231088d

Operating System used.

Windows

How did you build your project?

Command line with Make

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

None

What is the expected behavior?

Before, when I wanted to update esp-idf, I would do git pull. If it required a new toolchain, I would run install.ps1. I expected this to continue to work.

What is the actual behavior?

An error is thrown in idf_tools.py line 3157:

[9:53:33 am] ~/esp/esp-idf> .\install.ps1
Installing ESP-IDF tools
Traceback (most recent call last):
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 3157, in <module>
    main(sys.argv[1:])
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 3149, in main
    action_func(args)
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 2303, in action_install
    targets = add_and_check_targets(idf_env_obj, args.targets)
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 1710, in add_and_check_targets
    targets = parse_targets_arg(targets_str)
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 1691, in parse_targets_arg
    targets_from_tools_json = get_all_targets_from_tools_json()
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 1744, in get_all_targets_from_tools_json
    tools_info = load_tools_info()
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 1538, in load_tools_info
    return parse_tools_info_json(tools_info)  # type: ignore
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 1553, in parse_tools_info_json
    tool = IDFTool.from_json(tool_dict)
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 1230, in from_json
    if Platforms.get(platform_id) is None:
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 215, in get
    platform_name = Platforms.detect_linux_arm_platform(platform_name)
  File "C:\Users\Sean\esp\esp-idf\tools\idf_tools.py", line 186, in detect_linux_arm_platform
    with open(sys.executable, 'rb') as f:
OSError: [Errno 22] Invalid argument: 'C:\\Users\\Sean\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\python.exe'
[9:53:36 am] ~/esp/esp-idf> git describe --tags
v5.3-dev-1978-g4fb231088d
[9:54:07 am] ~/esp/esp-idf> C:\\Users\\Sean\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\python.exe
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
[9:56:05 am] ~/esp/esp-idf>

Steps to reproduce.

  1. Clone esp-idf
  2. Run install.ps1

Build or installation Logs.

No response

More Information.

No response

@xobs xobs added the Type: Bug bugs in IDF label Feb 9, 2024
@xobs
Copy link
Contributor Author

xobs commented Feb 9, 2024

Note that it works if I checkout v5.3-dev rather than master, so the issue seems to have been introduced since then.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 9, 2024
@github-actions github-actions bot changed the title Cannot run install.ps1: Invalid argument Cannot run install.ps1: Invalid argument (IDFGH-12090) Feb 9, 2024
@mfialaf
Copy link
Collaborator

mfialaf commented Feb 9, 2024

Hi @xobs,
Since Windows installations may sometimes be a little tricky, as it seems in your case, I recommend using our ESP-IDF Windows Installer.
It provides functional installation and prevents incompatible issues.
In the installer you can choose to use existing ESP-IDF or download a new instance so it does not affect your current setup.

I can see that you are using Python downloaded from the Microsoft store, which sometimes does not work properly.

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development and removed Status: Opened Issue is new labels Feb 12, 2024
@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Selected for Development Issue is selected for development Status: Reviewing Issue is being reviewed labels Feb 21, 2024
@xobs
Copy link
Contributor Author

xobs commented Feb 27, 2024

The ESP-IDF Windows Installer did not succeed in installing.

I bisected it down to c2d6a9e. The problem comes from the fact that sys.executable is a link, and Python doesn't seem to understand links very well:

[12:41:25 pm] ~> dir $(get-command python).Source

    Directory: C:\Users\Sean\AppData\Local\Microsoft\WindowsApps

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
la---           15/4/2023 10:07 am              0 python.exe ->

[12:41:37 pm] ~> &$(get-command python).Source --version
Python 3.10.11
[12:41:56 pm] ~>

After export.ps1 is run the Espressif Python is first in the path, so it will work from then on, however if the default Python is a symbolic link then the thing fails.

One interesting bit is that supposed_platform is linux-arm64 on this platform for some reason. It looks like it's doing detection of all platforms one by one.

A workaround that lets me continue is to apply this patch:

diff --git a/tools/idf_tools.py b/tools/idf_tools.py
index c08e5f3d13..79ddd13408 100755
--- a/tools/idf_tools.py
+++ b/tools/idf_tools.py
@@ -179,6 +179,9 @@ class Platforms:
         ARM platform may run on aarch64 hardware but having armhf installed packages
         (it happens if a docker container is running on arm64 hardware, but using an armhf image).
         """
+        if os.name == 'nt':
+            return supposed_platform
+
         if supposed_platform not in (PLATFORM_LINUX_ARM32, PLATFORM_LINUX_ARMHF, PLATFORM_LINUX_ARM64):
             return supposed_platform

@xobs
Copy link
Contributor Author

xobs commented Feb 28, 2024

Thanks for the fix!

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

No branches or pull requests

3 participants