mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-30 00:22:10 -04:00
Prefer Python 3.11+ in Windows launcher
This commit is contained in:
@@ -227,13 +227,16 @@ Or do it by hand:
|
|||||||
```powershell
|
```powershell
|
||||||
git clone https://github.com/pewdiepie-archdaemon/odysseus.git
|
git clone https://github.com/pewdiepie-archdaemon/odysseus.git
|
||||||
cd odysseus
|
cd odysseus
|
||||||
python -m venv venv
|
py -3.11 -m venv venv
|
||||||
venv\Scripts\Activate.ps1
|
venv\Scripts\Activate.ps1
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
python setup.py
|
python setup.py
|
||||||
python -m uvicorn app:app --host 127.0.0.1 --port 7000
|
python -m uvicorn app:app --host 127.0.0.1 --port 7000
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If `python` points at an older interpreter, use `py -3.12` (or another installed
|
||||||
|
3.11+ version) for the venv step.
|
||||||
|
|
||||||
**Requirements:** Python 3.11+. The core app (chat, agent, memory, documents,
|
**Requirements:** Python 3.11+. The core app (chat, agent, memory, documents,
|
||||||
email, calendar, deep research) runs fully native. For full **Cookbook** background
|
email, calendar, deep research) runs fully native. For full **Cookbook** background
|
||||||
model downloads and the agent shell tool, also install
|
model downloads and the agent shell tool, also install
|
||||||
|
|||||||
+44
-7
@@ -30,23 +30,60 @@ function Fail($msg) {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# 1. Locate a Python interpreter (3.11+ recommended)
|
# 1. Locate a Python interpreter (3.11+ required)
|
||||||
Write-Step "Checking for Python"
|
Write-Step "Checking for Python"
|
||||||
|
function Get-PythonVersionText($launcher, $launcherArgs) {
|
||||||
|
try {
|
||||||
|
return (& $launcher @launcherArgs -c "import sys; print('.'.join(map(str, sys.version_info[:3])))" 2>$null).Trim()
|
||||||
|
} catch {
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$pyExe = $null
|
$pyExe = $null
|
||||||
foreach ($c in @("python", "py")) {
|
$pyArgs = @()
|
||||||
$cmd = Get-Command $c -ErrorAction SilentlyContinue
|
$pyVersion = $null
|
||||||
if ($cmd) { $pyExe = $cmd.Source; break }
|
|
||||||
|
$pyLauncher = Get-Command py -ErrorAction SilentlyContinue
|
||||||
|
if ($pyLauncher) {
|
||||||
|
foreach ($v in @("-3.13", "-3.12", "-3.11")) {
|
||||||
|
$ver = Get-PythonVersionText $pyLauncher.Source @($v)
|
||||||
|
if ($ver) {
|
||||||
|
$pyExe = $pyLauncher.Source
|
||||||
|
$pyArgs = @($v)
|
||||||
|
$pyVersion = $ver
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (-not $pyExe) {
|
if (-not $pyExe) {
|
||||||
Fail "Python not found on PATH. Install Python 3.11+ from https://www.python.org/downloads/ (check 'Add to PATH'), then re-run this script."
|
$pythonCmd = Get-Command python -ErrorAction SilentlyContinue
|
||||||
|
if ($pythonCmd) {
|
||||||
|
$ver = Get-PythonVersionText $pythonCmd.Source @()
|
||||||
|
if ($ver) {
|
||||||
|
$versionParts = $ver.Split('.')
|
||||||
|
$major = [int]$versionParts[0]
|
||||||
|
$minor = [int]$versionParts[1]
|
||||||
|
if ($major -gt 3 -or ($major -eq 3 -and $minor -ge 11)) {
|
||||||
|
$pyExe = $pythonCmd.Source
|
||||||
|
$pyVersion = $ver
|
||||||
}
|
}
|
||||||
Write-Host ("Using Python: " + $pyExe)
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $pyExe) {
|
||||||
|
Fail "Couldn't find Python 3.11+ for Windows setup. Install Python 3.11+ (or open the Python launcher with 'py -3.11') from https://www.python.org/downloads/, then re-run this script."
|
||||||
|
}
|
||||||
|
$pythonLabel = ("Using Python {0}: {1} {2}" -f $pyVersion, $pyExe, ($pyArgs -join ' ')).TrimEnd()
|
||||||
|
Write-Host $pythonLabel
|
||||||
|
|
||||||
# 2. Create the virtualenv if missing
|
# 2. Create the virtualenv if missing
|
||||||
$venvPy = Join-Path $PSScriptRoot "venv\Scripts\python.exe"
|
$venvPy = Join-Path $PSScriptRoot "venv\Scripts\python.exe"
|
||||||
if (-not (Test-Path $venvPy)) {
|
if (-not (Test-Path $venvPy)) {
|
||||||
Write-Step "Creating virtual environment (venv)"
|
Write-Step "Creating virtual environment (venv)"
|
||||||
& $pyExe -m venv venv
|
& $pyExe @pyArgs -m venv venv
|
||||||
if ($LASTEXITCODE -ne 0 -or -not (Test-Path $venvPy)) { Fail "Failed to create the virtual environment." }
|
if ($LASTEXITCODE -ne 0 -or -not (Test-Path $venvPy)) { Fail "Failed to create the virtual environment." }
|
||||||
} else {
|
} else {
|
||||||
Write-Host "venv already exists - skipping creation."
|
Write-Host "venv already exists - skipping creation."
|
||||||
|
|||||||
Reference in New Issue
Block a user