Build failing on Windows w python 3.7 and 3.8
Hi build maintainers, If this is not the correct place to post please let me know. I'm running into an issue with building my package where build works great across versions of python on mac and linux but not on windows. specifically python 3.7 and 3.8 are failing on CI.
Essentially i'm setting up a test suite and want to run my tests on the installed package rather than the package files. And i'm using setupup_tools scm for the version string updates. It seems like it's failing when it tries to install the venv / virtual environment. but i'm not sure why. I tried to reinstall build just in case something was off with the install and that didn't work. Many thanks for any guidance or direction here. i've searched online and through issues but it's a tricky failure to identify.
# Build package
python[3](https://github.com/lwasser/stravalib/actions/runs/3483777180/jobs/5827630219#step:9:3) -m pip install build
python3 -m build
shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
env:
pythonLocation: C:\hostedtoolcache\windows\Python\3.8.10\x6[4](https://github.com/lwasser/stravalib/actions/runs/3483777180/jobs/5827630219#step:9:4)
PKG_CONFIG_PATH: C:\hostedtoolcache\windows\Python\3.8.10\x64/lib/pkgconfig
Python_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.8.10\x64
Python2_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.8.10\x64
Python3_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.8.10\x64
Requirement already satisfied: build in c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages (0.9.0)
Requirement already satisfied: tomli>=1.0.0 in c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages (from build) (2.0.1)
Requirement already satisfied: pep[5](https://github.com/lwasser/stravalib/actions/runs/3483777180/jobs/5827630219#step:9:5)17>=0.9.1 in c:\hostedtoolcache\windows\python\3.8.10\x[6](https://github.com/lwasser/stravalib/actions/runs/3483777180/jobs/5827630219#step:9:6)4\lib\site-packages (from build) (0.13.0)
Requirement already satisfied: colorama in c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages (from build) (0.4.6)
Requirement already satisfied: packaging>=19.0 in c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages (from build) (21.3)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages (from packaging>=19.0->build) (3.0.9)
* Creating venv isolated environment...
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\build\__main__.py", line 373, in main
built = build_call(
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\build\__main__.py", line 233, in build_package_via_sdist
sdist = _build(isolation, builder, outdir, 'sdist', config_settings, skip_dependency_check)
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\build\__main__.py", line 143, in _build
return _build_in_isolated_env(builder, outdir, distribution, config_settings)
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\build\__main__.py", line 107, in _build_in_isolated_env
with _IsolatedEnvBuilder() as env:
File "C:\hostedtoolcache\windows\Python\3.[8](https://github.com/lwasser/stravalib/actions/runs/3483777180/jobs/5827630219#step:9:8).10\x64\lib\site-packages\build\env.py", line 104, in __enter__
executable, scripts_dir = _create_isolated_env_venv(self._path)
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\build\env.py", line 26[9](https://github.com/lwasser/stravalib/actions/runs/3483777180/jobs/5827630219#step:9:9), in _create_isolated_env_venv
venv.EnvBuilder(with_pip=True, symlinks=symlinks).create(path)
File "C:\hostedtoolcache\windows\Python\3.8.[10](https://github.com/lwasser/stravalib/actions/runs/3483777180/jobs/5827630219#step:9:10)\x64\lib\venv\__init__.py", line 68, in create
self._setup_pip(context)
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\venv\__init__.py", line 289, in _setup_pip
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 13[11](https://github.com/lwasser/stravalib/actions/runs/3483777180/jobs/5827630219#step:9:11), in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
ERROR [WinError 2] The system cannot find the file specified
Error: Process completed with exit code 1.
Could you try installing virtualenv as well (or pip install "build[virtualenv]", if you prefer)? Looks like venv is failing to setup pip.
Similar to what's happening here I think?
https://github.com/pypa/build/issues/253
(but without the added complication of conda)
wow @henryiii that fixed the builds! see here it's now all green!
thank you very much. Is this a quick with windows and the older versions of python? so it's good practice to just install virtualenv?
i just couldn't figure out why it worked on all other platforms and versions. Many many thanks!
I'm not sure what's broken with venv there, but virtualenv is faster and more up-to-date than venv (since venv is built-in, and virtualenv is the PyPI package it was somewhat based on). venv usually should work, but there are some rare cases where it's broken. I'm not sure if this is something we can improve (since we are just asking for a venv with pip). I do know we test on Windows with venv.
This looks more like a GitHub Action issue to me.
I stumbled onto this issue in configparser today (https://github.com/jaraco/configparser/actions/runs/5492378721/jobs/10009816108). I see the error message:
build.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
Indeed, setting the dependency to build[virtualenv] seems to work around the issue.
In the case of configparser, the issue seems to be that running py -m venv with utf-8 in ./setup.cfg will fail to parse.
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 62: character maps to <undefined>
Oh, my instance may be a re-manifestation of https://github.com/pypa/pip/issues/8931 possibly due to other changes in the config. I'll continue investigation in https://github.com/jaraco/configparser/issues/67.