Skip to content

Conversation

@fengju0213
Copy link
Collaborator

@fengju0213 fengju0213 commented Nov 27, 2025

Problem: Backend startup fails on Windows after a system restart with the error Backend environment check failed: No Python at .... This occurs because uv cannot locate the Python environment specified during installation. Additionally, the existing auto-repair mechanism fails to recover when the Python installation is corrupted (i.e., the directory exists but python.exe is missing).

Changes:

Consistent Environment Variables: Explicitly injected UV_PYTHON_INSTALL_DIR and UV_TOOL_DIR in
startBackend
to ensure the runtime configuration matches the installation configuration, allowing uv to correctly locate the cached Python environment.
Enhanced Auto-Repair: Improved the repair logic upon pre-flight check failure:
Added detection and cleanup for corrupted Python installations (where the directory exists but the executable is missing).
Added an explicit uv python install step before running uv sync to ensure the Python interpreter is correctly reinstalled.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Copy link
Contributor

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @fengju0213 , I think we could fix this issue by creating a unified getUvEnv() function in process.ts, which doesn't require hardcoded env path, also more easy to maintain: #773


try {
// Check if python executable exists but is corrupted
const pythonPath = path.join(getCachePath('uv_python'), 'cpython-3.10.16-windows-x86_64-none', 'python.exe');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this path only works on Windows x86_64. The repair logic will not work correctly on macos

Comment on lines +168 to +169
UV_PYTHON_INSTALL_DIR: getCachePath('uv_python'),
UV_TOOL_DIR: getCachePath('uv_tool'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UV environment variables are now defined separately in both install-deps.ts and init.ts, which could lead to inconsistencies if one is updated but not the other

@fengju0213 fengju0213 closed this Nov 27, 2025
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.

[Feature Request] Desktop app not working after restarting in Windows

3 participants