Repository navigation
Enable CLI Usage on Windows #83
Replies: 2 comments
|
+1, I hit the same crash on Windows 11. The import guard above fixes startup, but some other commands still break on Windows after that, so I went through the rest and put together a patch that covers them: Patch: windows-support.patch (9 files, +176/−21, against Or install it directly on Windows: What it adds beyond the import guard:
Every Windows-specific change sits behind Testing:
Known gaps:
I'm happy to test future changes on Windows if that helps. |
|
Test report: google-colab-cli 0.8.0 on native Windows 10 (no WSL) Environment: Windows 10 Pro 22H2 (build 19045), Python 3.13, CLI installed with What works:
What does not work:
Request: official native Windows support, or at least a tested command matrix as |
Uh oh!
There was an error while loading. Please reload this page.
Summary
On Windows, no
colabcommand runs at all — not justconsole.console.pyimports the POSIX-onlytermios/ttymodules at module top level, and becausecommands/execution.pydoesfrom colab_cli.console import connect_consoleat load time, the import chain fails before Typer ever dispatches a subcommand. Evencolab -hcrashes.Environment
google-colab-cli0.6.0 (from PyPI)Repro
(
import colab_cli.clireproduces it directly, no CLI invocation needed.)Root cause
console.pyunconditionally doesimport termios/import ttyat the top. These modules are Unix-only. They're only actually used insideconnect_console, and only on a real POSIX TTY (raw-mode setup +SIGWINCH). So the top-level import is the only thing preventing the CLI from working on Windows — the rest of the surface (new,exec,run,sessions,install, …) has no POSIX dependency.Suggested fix
Guard the imports and only take the raw-terminal path when those modules are present. Piped/agent usage sets
is_tty=Falseand never touches them, so behavior is unchanged everywhere it works today; interactivecolab consoleon Windows would fall back to line-buffered input instead of crashing.Then in
connect_console:I applied this locally and confirmed native Windows then works end-to-end (
colab -h, ADC auth, and acolab runCPU one-shot against a real Colab VM). Happy to share more detail if useful -- in the meantime, thank you for all your efforts!All reactions