[GH-ISSUE #1574] First install fails when .venv exists but uv-managed Python is missing (uv inspect error 103) #463

Open
opened 2026-10-31 22:13:19 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @benceruleanlu on GitHub (Jan 31, 2026).
Original GitHub issue: https://github.com/Comfy-Org/desktop/issues/1574

Summary

First-time install can fail when a partially created .venv exists but uv’s managed Python is missing. hasRequirements() calls uv pip install --dry-run which fails with “Failed to inspect Python interpreter … exit code: 103”, and the install aborts.

Logs (Jan 31, 2026)

error: Failed to inspect Python interpreter from active virtual environment at `.venv\Scripts\python.exe`
Caused by: Querying Python at `C:\Users\rdpuser\Documents\ComfyUI\.venv\Scripts\python.exe` failed with exit status exit code: 103
[stderr] No Python at '"C:\Users\rdpuser\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\python.exe'

Then:

Failed to get packages: Exit code 2

Suspected cause

If the first install is interrupted or the uv-managed Python download/extract fails, .venv exists but python.exe points to a missing managed Python. VirtualEnvironment.createEnvironment() treats any existing .venv as usable and calls hasRequirements(), which fails in uv’s inspection phase.

Proposed fix

  • In VirtualEnvironment.createEnvironment(), before calling hasRequirements() on an existing .venv, verify the python interpreter is executable; if not, remove the venv and recreate.
  • In validation, only call hasRequirements() when python is OK to avoid noisy uv errors.

Repro (likely)

  1. Start fresh install on Windows.
  2. Interrupt during uv python download/venv creation (or delete %APPDATA%\uv\python after .venv created).
  3. Relaunch app; install fails with uv inspect error 103.

Expected

Installer should recover by recreating the venv when the python interpreter is missing or invalid.

┆Issue is synchronized with this Notion page by Unito

Originally created by @benceruleanlu on GitHub (Jan 31, 2026). Original GitHub issue: https://github.com/Comfy-Org/desktop/issues/1574 ## Summary First-time install can fail when a partially created `.venv` exists but uv’s managed Python is missing. `hasRequirements()` calls `uv pip install --dry-run` which fails with “Failed to inspect Python interpreter … exit code: 103”, and the install aborts. ## Logs (Jan 31, 2026) ``` error: Failed to inspect Python interpreter from active virtual environment at `.venv\Scripts\python.exe` Caused by: Querying Python at `C:\Users\rdpuser\Documents\ComfyUI\.venv\Scripts\python.exe` failed with exit status exit code: 103 [stderr] No Python at '"C:\Users\rdpuser\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\python.exe' ``` Then: ``` Failed to get packages: Exit code 2 ``` ## Suspected cause If the first install is interrupted or the uv-managed Python download/extract fails, `.venv` exists but `python.exe` points to a missing managed Python. `VirtualEnvironment.createEnvironment()` treats any existing `.venv` as usable and calls `hasRequirements()`, which fails in uv’s inspection phase. ## Proposed fix - In `VirtualEnvironment.createEnvironment()`, before calling `hasRequirements()` on an existing `.venv`, verify the python interpreter is executable; if not, remove the venv and recreate. - In validation, only call `hasRequirements()` when python is OK to avoid noisy uv errors. ## Repro (likely) 1. Start fresh install on Windows. 2. Interrupt during uv python download/venv creation (or delete `%APPDATA%\uv\python` after `.venv` created). 3. Relaunch app; install fails with uv inspect error 103. ## Expected Installer should recover by recreating the venv when the python interpreter is missing or invalid. ┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-1574-First-install-fails-when-venv-exists-but-uv-managed-Python-is-missing-uv-inspect-err-2f96d73d3650813687f3e6978b7b2cc8) by [Unito](https://www.unito.io)
Author
Owner

@dosubot[bot] commented on GitHub (Jan 31, 2026):

You’ve correctly identified the root cause: if the .venv directory exists but the uv-managed Python interpreter is missing (often due to an interrupted install), the installer assumes the environment is valid and immediately calls hasRequirements(). This triggers a uv pip install --dry-run, which fails with an error like “Failed to inspect Python interpreter … exit code: 103” because the Python executable is missing. The install then aborts without attempting recovery.

Currently, the code does not explicitly check if the Python interpreter is present or executable before running uv commands. Instead, it relies on the presence of the .venv directory and only attempts recovery after requirements or import verification fails, often requiring user intervention or a manual reset of the environment. This behavior is confirmed in both the implementation and recent merged PRs (#1299, #1313, #1316), which improved recovery from partial or corrupt venvs but do not yet add a pre-check for interpreter executability before calling hasRequirements() (source).

Your proposed fix—to verify the Python interpreter is executable before calling hasRequirements() and to remove/recreate the venv if not—would make the installer more robust and prevent this class of install failures. This check is not currently implemented, so adding it would address the noisy uv errors and improve the recovery experience.

For now, the main workaround remains to manually delete the .venv directory and restart the app, which forces a clean environment setup. Automatic detection and recreation of a missing or invalid Python interpreter is a logical next step for further improvement.

References for further reading and tracking:

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about desktop with Dosu Add Dosu to your team

<!-- gh-comment-id:3827690628 --> @dosubot[bot] commented on GitHub (Jan 31, 2026): <!-- Answer --> You’ve correctly identified the root cause: if the `.venv` directory exists but the uv-managed Python interpreter is missing (often due to an interrupted install), the installer assumes the environment is valid and immediately calls `hasRequirements()`. This triggers a `uv pip install --dry-run`, which fails with an error like “Failed to inspect Python interpreter … exit code: 103” because the Python executable is missing. The install then aborts without attempting recovery. Currently, the code does not explicitly check if the Python interpreter is present or executable before running uv commands. Instead, it relies on the presence of the `.venv` directory and only attempts recovery after requirements or import verification fails, often requiring user intervention or a manual reset of the environment. This behavior is confirmed in both the implementation and recent merged PRs ([#1299](https://github.com/Comfy-Org/desktop/pull/1299), [#1313](https://github.com/Comfy-Org/desktop/pull/1313), [#1316](https://github.com/Comfy-Org/desktop/pull/1316)), which improved recovery from partial or corrupt venvs but do not yet add a pre-check for interpreter executability before calling `hasRequirements()` ([source](https://github.com/Comfy-Org/desktop/blob/73d552c0b4005ac3a0d1cb57dd996b024e939365/src/virtualEnvironment.ts#L306-L1080)). Your proposed fix—to verify the Python interpreter is executable before calling `hasRequirements()` and to remove/recreate the venv if not—would make the installer more robust and prevent this class of install failures. This check is not currently implemented, so adding it would address the noisy uv errors and improve the recovery experience. For now, the main workaround remains to manually delete the `.venv` directory and restart the app, which forces a clean environment setup. Automatic detection and recreation of a missing or invalid Python interpreter is a logical next step for further improvement. References for further reading and tracking: - [PR #1299: Improve venv recovery logic](https://github.com/Comfy-Org/desktop/pull/1299) - [PR #1313: Recover partial venv installations](https://github.com/Comfy-Org/desktop/pull/1313) - [PR #1316: Prompt to reinstall venv on import errors](https://github.com/Comfy-Org/desktop/pull/1316) - [Current VirtualEnvironment implementation](https://github.com/Comfy-Org/desktop/blob/73d552c0b4005ac3a0d1cb57dd996b024e939365/src/virtualEnvironment.ts#L306-L1080) - [Related issue: install loop and venv corruption](https://github.com/Comfy-Org/desktop/issues/1395) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=Comfy-Org%2Fdesktop).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=Comfy-Org%2Fdesktop). [![Leave Feedback](https://img.shields.io/badge/Leave%20Feedback-555555?style=flat)](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=Comfy-Org%2Fdesktop#message_id=9c5f4dcf-38f7-4b24-9134-6374000b85c4) [![Learn about desktop with Dosu](https://img.shields.io/badge/Learn%20about%20desktop%20with%20Dosu-2f7b3f?style=flat&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iODYiIGhlaWdodD0iODkiIHZpZXdCb3g9IjAgMCA4NiA4OSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNS4yOTIzNiAxMi43OTI4TDE3Ljc1OTMgNi42ODE4OFY3Mi41NjY3TDUuMjkyMzYgODQuMDYxOFYxMi43OTI4WiIgZmlsbD0iI0I0QkI5MSIvPjxwYXRoIGQ9Ik0xOC4yNTc1IDczLjExOTZMNTkuMTMyOSA3Mi43NDhMNTEuNzAxMSA4Mi40MDk1TDI5LjAzMzggODYuMjkxTDYuMjM5NjIgODUuMTU1NEwxOC4yNTc1IDczLjExOTZaIiBmaWxsPSIjNzc4NTYxIi8%2BPHBhdGggZD0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NjkxNjEiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0wLjM0ODYzMyA4NS40OTQ2QzAuMzQ4NjMzIDg1LjQ5NDYgMjkuNDg1NiA4NS44MzA5IDM0LjgwOSA4NS42OThDNDQuODMzNyA4NS40NDc3IDUxLjI4NzIgODQuNDAyIDU3LjUyNjkgNzguOTcyNEM2Mi44MTI5IDc0LjM3MjcgNzUuMTM0MiA1OS42ODM2IDc1LjEzNDIgNTkuNjgzNiIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSI2LjE2NDgyIi8%2BPC9zdmc%2B)](https://github.dosu.com/Comfy-Org/desktop?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=Comfy-Org%2Fdesktop) [![Add Dosu to your team](https://img.shields.io/badge/Add%20Dosu%20to%20your%20team-1f6feb?style=flat)](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=Comfy-Org%2Fdesktop)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/desktop#463
No description provided.