Skip to content

feat: Add Windows setup script (installs Python 3.12 + Git, napari 0.7) - #407

Open
hongquanli wants to merge 4 commits into
masterfrom
feat/add-windows-setup-script
Open

feat: Add Windows setup script (installs Python 3.12 + Git, napari 0.7)#407
hongquanli wants to merge 4 commits into
masterfrom
feat/add-windows-setup-script

Conversation

@hongquanli

@hongquanli hongquanli commented Jan 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds software/setup_windows.ps1, a one-shot installer for Windows: it installs the
prerequisites, clones the repo, installs the Python dependencies, and drops a desktop
shortcut. Targets Python 3.12 and napari 0.7.

Running it on a clean Windows 10/11 machine with nothing preinstalled should be enough
to get to a launchable Squid.

What it does

  • Installs Python 3.12 and Git if missing. Both are downloaded from their official
    hosts, checked against a pinned SHA256 before being run, and installed silently
    per-user — no admin rights, no UAC prompt. -SkipPythonInstall / -SkipGitInstall
    opt out on machines where these are managed centrally.
  • Resolves a specific interpreter rather than trusting whatever python happens to
    be. Probes py -3.12 first, then python3.12/python3/python, then the default
    per-user install directory, checking version and 64-bitness. Every later pip call
    and the desktop shortcut are pinned to that exact sys.executable.
  • Clones with --recurse-submodules and updates submodules on an existing checkout.
  • Installs the Python dependencies in a single pip call, then warns if PyQt6 ended
    up in the environment anyway.
  • Creates Squid_hcs.lnk on the Desktop with the Cephla icon.
  • Prints camera-driver instructions (Daheng SDK is a manual download; ToupCam ships
    in the repo).

Notable decisions

napari[pyqt5]==0.7.1, not napari[all]. As of napari 0.7 the all/qt extras
resolve to PyQt6, while Squid's GUI is PyQt5 via qtpy. The PyQt5 extra is requested
explicitly so the two bindings can't end up side by side.

Python is pinned at 3.12.10 because that is the last 3.12 release with a Windows
binary installer — 3.12.11 and later are source-only security releases. This version
will not need bumping.

Git is pinned at 2.55.0.3 for reproducibility rather than compatibility; Squid works
with any modern Git. Its SHA256 is the one published in the release notes, which matches
the GitHub API's asset digest.

Dependency list follows setup_26.04.sh (#568) and what master actually imports:

  • drops aicsimageio / basicpy — their only importer is control/stitcher.py, which
    nothing imports (the active stitcher is tools/stitcher.py, the ImageJ path). Both are
    awkward to build on Windows, so dropping the dead dependency de-risks the install. This
    also removes the reason for the numpy<2 cap.
  • adds pyqtgraph and PyQt5, which the Ubuntu scripts get from apt
  • adds pyyaml, platformdirs, filelock, lxml_html_clean, mcp, ndv — all hard
    imports on master that were missing
  • adds tensorstore, required by the ZARR_V3 file_saving_option

Deliberately still not installed: pipython (lazy import, real-hardware path behind
USE_PI_FOCUS_STAGE) and scyjava (standalone ImageJ tool, needs a JVM).

Verification

Resolved the full dependency set against Windows / Python 3.12
(pip install --dry-run --only-binary=:all: --python-version 3.12 --platform win_amd64):
napari-0.7.1, PyQt5-5.15.11, no PyQt6, numpy-2.5.1, tensorstore-0.1.85, and
qtconsole/ipython arriving transitively via napari-console so control/console.py
works.

The script itself parses clean (0 syntax errors) and passes PSScriptAnalyzer apart from
PSAvoidUsingWriteHost, which is intentional for a colored interactive installer. The
helper functions were unit-tested by extracting them from the AST: interpreter probing
against a real 3.12, the rejection paths (missing binary, non-zero exit with stderr,
truncated output), and the installer integrity gate — a wrong hash aborts before anything
executes, names both hashes, and deletes the download.

Not yet verified: the download-and-install path has never run on real Windows.
Start-Process behavior, the silent-install flags, and the post-install PATH refresh are
all Windows-only and need a real machine.

Test plan

  • Run .\setup_windows.ps1 on a clean Windows 10/11 box with no Python and no
    Git installed — both should install without a UAC prompt
  • Run it again on the same box; it should detect both and skip straight to pip
  • Run with a non-3.12 Python already on PATH — 3.12 should install alongside and be
    the one used
  • Verify python -c "import qtpy; print(qtpy.API_NAME)" reports PyQt5
  • Verify the desktop shortcut launches the application
  • Verify a ZARR_V3 acquisition saves (confirms tensorstore landed)

🤖 Generated with Claude Code

hongquanli and others added 2 commits August 9, 2026 01:59
Adds PowerShell setup script for Windows that:
- Checks for Python and Git prerequisites
- Clones the Squid repository
- Installs Python dependencies via pip
- Creates desktop shortcut with icon

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Require 64-bit Python 3.12 explicitly instead of accepting whatever
`python` resolves to: probe `py -3.12` first, then python3.12/python3/
python, and pin every later pip call and the desktop shortcut to the
resolved sys.executable.

Install napari as napari[pyqt5]==0.7.1 rather than napari[all]. As of
napari 0.7 the all/qt extras resolve to PyQt6, while Squid's GUI is
PyQt5 via qtpy, so the old list installed no PyQt5 at all. A post-install
check warns if PyQt6 ends up in the environment anyway.

Align the dependency list with setup_26.04.sh and with what master
actually imports:

- drop aicsimageio/basicpy (only importer is control/stitcher.py, which
  nothing imports) and the numpy<2 cap that existed for them
- add pyqtgraph and PyQt5, which the Ubuntu scripts get from apt
- add pyyaml, platformdirs, filelock, lxml_html_clean, mcp and ndv,
  all hard imports that were missing
- add tensorstore, required by the ZARR_V3 file_saving_option
- install in a single pip call so the resolver sees every constraint

Also fix two latent failures:

- git clone now recurses submodules; control/ndviewer_light and
  fluidics_v2 are submodules and the GUI will not start without them
- $ErrorActionPreference does not apply to native executables, so a
  failing pip or git only set $LASTEXITCODE and the script carried on to
  create a desktop shortcut for a broken install

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@hongquanli
hongquanli force-pushed the feat/add-windows-setup-script branch from d126d65 to 98ad847 Compare August 9, 2026 09:05
hongquanli and others added 2 commits August 9, 2026 04:10
The script previously required the user to have installed Python 3.12
themselves and failed with instructions otherwise. Install it instead:
download the official python.org installer, verify its SHA256, and run
it silently.

The install is per-user (InstallAllUsers=0, InstallLauncherAllUsers=0),
so it needs no admin rights and raises no UAC prompt. Since the
installer only edits PATH for new processes, the script refreshes
$env:Path from the registry afterwards and also probes the default
per-user install location directly, then re-runs discovery.

Pins 3.12.10 because it is the last 3.12 release with a Windows binary
installer - 3.12.11 and later are source-only security releases. Pass
-SkipPythonInstall to keep the old fail-with-instructions behaviour on
machines where Python is managed centrally.

Interpreter discovery moves into Find-Python312 so it can run both
before and after the install.

Fixes a bitness check that rejected every interpreter: the probe printed
8 * (sys.maxsize > 2**32), which is 8 on a 64-bit Python rather than 64,
because Python's True is 1. Compared against 64, no interpreter could
ever be accepted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Git was the last prerequisite the script still required the user to
install by hand. Fetch it the same way as Python: download the pinned
Git for Windows installer, verify its SHA256, run it silently.

Git for Windows is an Inno Setup installer built with
PrivilegesRequired=none, so an unelevated run installs per-user into
%LOCALAPPDATA%\Programs\Git and records itself under HKCU rather than
HKLM - no UAC prompt, matching the Python install. Run elevated it
installs machine-wide instead; Find-Git handles either by checking PATH,
then both registry keys, then the two default directories.

Every git call site now uses the resolved $GitExe rather than bare
`git`, since a Git installed by this script is not on this process's
PATH.

The download/verify/run/refresh-PATH sequence is now shared by both
prerequisites as Invoke-SilentInstaller instead of being duplicated,
with the per-installer differences (silent flags, accepted exit codes,
manual-install URL) passed in.

Git is pinned at 2.55.0.3 for reproducibility rather than compatibility
- Squid works with any modern Git. Its SHA256 is the one published in
the release notes, which matches the GitHub API's asset digest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@hongquanli hongquanli changed the title feat: Add Windows setup script feat: Add Windows setup script (installs Python 3.12 + Git, napari 0.7) Aug 9, 2026
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 this pull request may close these issues.

1 participant