Windows setup: pick a Python with ready-made wheels, fix Pillow build failure
Browse files- START-HERE.bat +18 -8
- Winery-Strata.zip +2 -2
- setup.py +7 -1
START-HERE.bat
CHANGED
|
@@ -4,12 +4,19 @@ rem Needs only an NVIDIA or AMD graphics driver. Python is installed for your us
|
|
| 4 |
setlocal
|
| 5 |
title Strata
|
| 6 |
cd /d "%~dp0"
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
call :findpy
|
| 10 |
if defined PY goto venv
|
| 11 |
echo.
|
| 12 |
-
echo Python 3.10
|
| 13 |
where winget >nul 2>nul
|
| 14 |
if errorlevel 1 goto pyorg
|
| 15 |
winget install -e --id Python.Python.3.12 --scope user --silent --source winget --accept-package-agreements --accept-source-agreements --disable-interactivity
|
|
@@ -42,11 +49,14 @@ if errorlevel 1 pause
|
|
| 42 |
exit /b
|
| 43 |
|
| 44 |
:findpy
|
| 45 |
-
rem
|
| 46 |
set "PY="
|
| 47 |
-
|
| 48 |
-
if not
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
| 52 |
goto :eof
|
|
|
|
| 4 |
setlocal
|
| 5 |
title Strata
|
| 6 |
cd /d "%~dp0"
|
| 7 |
+
rem a Python every package has ready-made wheels for: 64-bit CPython 3.10-3.14, released, not free-threaded, not MSYS
|
| 8 |
+
set "PYOK=import sys,sysconfig as s; v=sys.version_info; sys.exit(0 if v[:2] in [(3,10),(3,11),(3,12),(3,13),(3,14)] and v.releaselevel=='final' and sys.maxsize>2**32 and not s.get_config_var('Py_GIL_DISABLED') and s.get_platform()=='win-amd64' else 1)"
|
| 9 |
+
if not exist ".venv\Scripts\python.exe" goto newvenv
|
| 10 |
+
".venv\Scripts\python.exe" -c "%PYOK%" >nul 2>nul
|
| 11 |
+
if not errorlevel 1 goto run
|
| 12 |
+
echo The .venv was made with a Python that pip has to compile packages for (Pillow fails). Rebuilding it ...
|
| 13 |
+
rmdir /s /q ".venv"
|
| 14 |
+
:newvenv
|
| 15 |
|
| 16 |
call :findpy
|
| 17 |
if defined PY goto venv
|
| 18 |
echo.
|
| 19 |
+
echo No suitable Python (64-bit 3.10-3.14) found. Installing Python 3.12 for your user account ...
|
| 20 |
where winget >nul 2>nul
|
| 21 |
if errorlevel 1 goto pyorg
|
| 22 |
winget install -e --id Python.Python.3.12 --scope user --silent --source winget --accept-package-agreements --accept-source-agreements --disable-interactivity
|
|
|
|
| 49 |
exit /b
|
| 50 |
|
| 51 |
:findpy
|
| 52 |
+
rem known-good versions first (py -3 alone picks the newest, which can be a pre-release with no wheels yet)
|
| 53 |
set "PY="
|
| 54 |
+
for %%V in (3.13 3.12 3.14 3.11 3.10) do if not defined PY call :try py -%%V
|
| 55 |
+
if not defined PY call :try python
|
| 56 |
+
for %%V in (313 312 314 311 310) do if not defined PY if exist "%LOCALAPPDATA%\Programs\Python\Python%%V\python.exe" call :try "%LOCALAPPDATA%\Programs\Python\Python%%V\python.exe"
|
| 57 |
+
goto :eof
|
| 58 |
+
|
| 59 |
+
:try
|
| 60 |
+
%* -c "%PYOK%" >nul 2>nul
|
| 61 |
+
if not errorlevel 1 set "PY=%*"
|
| 62 |
goto :eof
|
Winery-Strata.zip
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5ecdd93773b7897681652c61ee8a4b25da6369330579e233500caf7371ceec2
|
| 3 |
+
size 13659692
|
setup.py
CHANGED
|
@@ -1094,7 +1094,13 @@ def pip_install(packages, what):
|
|
| 1094 |
ok(f"{what} already installed")
|
| 1095 |
return
|
| 1096 |
say(f" Installing {what} ...")
|
| 1097 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1098 |
stamp.write_text(json.dumps(sorted(set(have) | set(need)), indent=0))
|
| 1099 |
ok(f"{what} installed")
|
| 1100 |
|
|
|
|
| 1094 |
ok(f"{what} already installed")
|
| 1095 |
return
|
| 1096 |
say(f" Installing {what} ...")
|
| 1097 |
+
pip = [sys.executable, "-m", "pip", "install", "--quiet", "--disable-pip-version-check", "--prefer-binary"]
|
| 1098 |
+
if run([*pip, *need], check=False).returncode != 0:
|
| 1099 |
+
# no ready-made wheel of a pinned version for this Python (pip tried to compile, e.g. Pillow): take the
|
| 1100 |
+
# newest release that has one instead of failing the whole setup
|
| 1101 |
+
say(" A pinned package has no ready-made wheel for this Python; retrying with ready-made wheels only ...")
|
| 1102 |
+
loose = sorted({req_name(p) for p in need})
|
| 1103 |
+
run([*pip, "--only-binary", ":all:", *loose])
|
| 1104 |
stamp.write_text(json.dumps(sorted(set(have) | set(need)), indent=0))
|
| 1105 |
ok(f"{what} installed")
|
| 1106 |
|