Skip to content

Self-improving AI Employees for everyone

fix(install): fall back to the official uv installer when pip is PEP 668-blocked

trohitg1b0f41b9a879
diff --git a/scripts/install.js b/scripts/install.js
index 6fa7aae9..6d6ffc14 100755
--- a/scripts/install.js
+++ b/scripts/install.js
@@ -95,9 +95,29 @@ function ensurePip(pythonCmd) {
}
function installUv(pythonCmd) {
- ensurePip(pythonCmd);
- console.log('Installing uv via pip...');
- run(`${pythonCmd} -m pip install uv`);
+ // pip first (works on Windows, macOS python.org builds, conda, venvs).
+ // On Debian/Ubuntu 24.04+, Fedora, Homebrew, etc. the system pip refuses
+ // with PEP 668 "externally-managed-environment" and Debian ships no
+ // ensurepip module, so fall back to the official standalone installer
+ // (https://docs.astral.sh/uv/getting-started/installation/), the same
+ // path install.sh takes. The installer drops uv in ~/.local/bin, which
+ // is not on PATH for this process yet, so prepend it before re-checking.
+ try {
+ ensurePip(pythonCmd);
+ console.log('Installing uv via pip...');
+ run(`${pythonCmd} -m pip install uv`);
+ return;
+ } catch (err) {
+ console.log(` pip install failed (${err.message.split('\n')[0]}); using the official uv installer...`);
+ }
+ const home = process.env.HOME || process.env.USERPROFILE || '';
+ if (process.platform === 'win32') {
+ run('powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"');
+ } else {
+ run('curl -LsSf https://astral.sh/uv/install.sh | sh');
+ }
+ const localBin = resolve(home, '.local', 'bin');
+ process.env.PATH = `${localBin}${process.platform === 'win32' ? ';' : ':'}${process.env.PATH || ''}`;
}
// ============================================================================
diff --git a/server/main.py b/server/main.py
index cac1b3bc..8057dab0 100644
--- a/server/main.py
+++ b/server/main.py
@@ -26,8 +26,11 @@ except ImportError:
pass # Windows - uvloop not available, use default asyncio
import asyncio
+import functools
+import json
from datetime import datetime
from contextlib import asynccontextmanager
+from pathlib import Path
# Note: We don't register custom signal handlers.
# uvicorn already handles SIGINT (Ctrl+C) and SIGTERM (docker stop) gracefully.
@@ -601,6 +604,22 @@ async def _sweep_cli_lockfiles_on_startup() -> None:
logger.debug("[main] CLI lockfile sweep failed: %s", exc)
[email protected]_cache(maxsize=1)
+def _app_version() -> str:
+ """The published OpenCompany version, read from the root ``package.json``.
+
+ That file is the single source of truth (``company version sync`` writes it
+ from the git tag), and it ships inside the npm package one level above
+ ``server/``. Never hardcode a literal here — ``/health`` previously reported
+ a stale ``3.3.0`` while the package was ``0.1.1``.
+ """
+ try:
+ pkg = json.loads((Path(__file__).resolve().parent.parent / "package.json").read_text(encoding="utf-8"))
+ return str(pkg.get("version") or "0.0.0")
+ except (OSError, json.JSONDecodeError):
+ return "0.0.0"
+
+
@app.get("/health")
async def health_check():
"""Detailed health check with resource monitoring."""
@@ -631,7 +650,7 @@ async def health_check():
return {
"status": health["status"],
"service": "python",
- "version": "3.3.0", # Bumped for daemon service support
+ "version": _app_version(),
"environment": "development" if settings.debug else "production",
"uptime_seconds": health["uptime_seconds"],
"resources": {