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

Build failures on Windows #46

Open
1 task done
choldgraf opened this issue Nov 8, 2023 · 4 comments · May be fixed by #47
Open
1 task done

Build failures on Windows #46

choldgraf opened this issue Nov 8, 2023 · 4 comments · May be fixed by #47

Comments

@choldgraf
Copy link
Contributor

choldgraf commented Nov 8, 2023

Link to source code that is involved in this issue

executablebooks/sphinx-book-theme#775

Reproducer

This is failing at a basic "install from pip" level on windows builds in GitHub for the Sphinx Book Theme. I've linked to a PR where the errors are seen and pasted logs from the failing build below.

Output containing crash traceback

return hook(wheel_directory, config_settings, metadata_directory)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-qx1ru23b\overlay\Lib\site-packages\sphinx_theme_builder\__init__.py", line 121, in build_editable
      return _generate_wheel(
             ^^^^^^^^^^^^^^^^
    File "C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-qx1ru23b\overlay\Lib\site-packages\sphinx_theme_builder\_internal\distributions.py", line 157, in generate_wheel_distribution
      generate_assets(project, production=not editable)
    File "C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-qx1ru23b\overlay\Lib\site-packages\sphinx_theme_builder\_internal\nodejs.py", line 322, in generate_assets
      populate_npm_packages(nodeenv, node_modules)
    File "C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-qx1ru23b\overlay\Lib\site-packages\sphinx_theme_builder\_internal\nodejs.py", line 232, in populate_npm_packages
      run_in(nodeenv, ["npm", "install", "--include=dev"])
    File "C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-qx1ru23b\overlay\Lib\site-packages\sphinx_theme_builder\_internal\nodejs.py", line 67, in run_in
      returncode = passthrough_run(args)
                   ^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-qx1ru23b\overlay\Lib\site-packages\sphinx_theme_builder\_internal\passthrough.py", line 97, in passthrough_run
      p = subprocess.run(args)
          ^^^^^^^^^^^^^^^^^^^^
    File "C:\hostedtoolcache\windows\Python\3.12.0\x64\Lib\subprocess.py", line 548, in run
      with Popen(*popenargs, **kwargs) as process:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\hostedtoolcache\windows\Python\3.12.0\x64\Lib\subprocess.py", line 1026, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File "C:\hostedtoolcache\windows\Python\3.12.0\x64\Lib\subprocess.py", line 1538, in _execute_child
      hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  OSError: [WinError 193] %1 is not a valid Win32 application
  [end of output]

Code of Conduct

@pradyunsg
Copy link
Owner

... Huh. That really should not happen, unless nodeenv straight up doesn't support Windows... but it should since pre-commit works on Windows?

@pradyunsg
Copy link
Owner

This does a shutil.which before to check that the npm executable exists, which it does, and evidently this worked earlier (which is why sphinx-book-theme even had this CI check in the first place).

Ok, a sleepy me is not going to figure this out at 12:55am -- there's a few too many pieces here for me to detangle. A smaller reproducer for this failure would be appreciated, although I understand that might be non-trivial.

To set expectations, I'm definitely not going to be able to investigate this until the weekend, and this weekend I'll have limited OSS time. 😅

@choldgraf
Copy link
Contributor Author

No worries - just wanted to surface this because I know not that many projects test on windows. Frankly I don't think it's too big of a deal right now because I don't know of anybody that develops that theme on a Windows environment, but just FYI

@agoose77
Copy link

So, this build failure happens in a fresh 3.12 environment, but not a fresh 3.11 environment. The cause appears to be the changes to shutil.which in Python 3.12.0, which finds the Bash npm executable rather than npm.cmd. In 3.12.1, this is supposedly fixed through the consultation of PATHEXT whereby which will prefer executables with .cmd extensions over bare binaries.

However, the most robust fix is probably to explicitly ask for npm.cmd on windows, to avoid this problem. I'll work up a PR.

@agoose77 agoose77 linked a pull request Nov 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants