mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: resolve hardcoded /app paths and loosen mediapipe pin for native installs
Path resolution for the feature manifest and install script was hardcoded to /app/..., which only works inside the Docker container. Native installs (e.g. Proxmox at /opt/snapotter) hit "No such file or directory" errors. Resolve both paths relative to the source file location via import.meta.url so they work regardless of where the project is installed. Also loosen mediapipe==0.10.21 to >=0.10.21 in requirements.txt and requirements-gpu.txt to match the feature manifest. The exact pin has no cp313 wheel, so it fails on Python 3.13 (Debian 13 default). mediapipe 0.10.35 ships py3-none universal wheels that resolve cleanly. Reported-by: MickLesk (community-scripts/ProxmoxVE#14720)
This commit is contained in:
@@ -11,19 +11,24 @@ import {
|
||||
unlinkSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import type { FeatureBundleState, FeatureStatus } from "@snapotter/shared";
|
||||
import { FEATURE_BUNDLES, TOOL_BUNDLE_MAP } from "@snapotter/shared";
|
||||
|
||||
// ── Paths ───────────────────────────────────────────────────────────────
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const PROJECT_ROOT = resolve(__dirname, "../../../..");
|
||||
|
||||
const DATA_DIR = process.env.DATA_DIR || "/data";
|
||||
const AI_DIR = join(DATA_DIR, "ai");
|
||||
const MODELS_DIR = join(AI_DIR, "models");
|
||||
const INSTALLED_PATH = join(AI_DIR, "installed.json");
|
||||
const INSTALLED_TMP_PATH = `${INSTALLED_PATH}.tmp`;
|
||||
const LOCK_PATH = join(AI_DIR, "install.lock");
|
||||
const MANIFEST_PATH = process.env.FEATURE_MANIFEST_PATH || "/app/docker/feature-manifest.json";
|
||||
const MANIFEST_PATH =
|
||||
process.env.FEATURE_MANIFEST_PATH || join(PROJECT_ROOT, "docker/feature-manifest.json");
|
||||
|
||||
export function getAiDir(): string {
|
||||
return AI_DIR;
|
||||
@@ -37,6 +42,10 @@ export function getManifestPath(): string {
|
||||
return MANIFEST_PATH;
|
||||
}
|
||||
|
||||
export function getInstallScriptPath(): string {
|
||||
return join(PROJECT_ROOT, "packages/ai/python/install_feature.py");
|
||||
}
|
||||
|
||||
// ── Directory setup ─────────────────────────────────────────────────────
|
||||
|
||||
export function ensureAiDirs(): void {
|
||||
|
||||
@@ -2,7 +2,7 @@ rembg==2.0.62
|
||||
realesrgan==0.3.0
|
||||
paddleocr==2.9.1
|
||||
paddlepaddle-gpu==3.0.0
|
||||
mediapipe==0.10.21
|
||||
mediapipe>=0.10.21
|
||||
onnxruntime-gpu==1.20.1
|
||||
numpy==1.26.4
|
||||
Pillow==11.1.0
|
||||
|
||||
@@ -2,7 +2,7 @@ rembg[cpu]==2.0.62
|
||||
realesrgan==0.3.0
|
||||
paddleocr[doc-parser]>=3.4.0,<3.5.0
|
||||
paddlepaddle>=3.0.0,<3.1.0
|
||||
mediapipe==0.10.21
|
||||
mediapipe>=0.10.21
|
||||
onnxruntime==1.20.1
|
||||
numpy==1.26.4
|
||||
Pillow==11.1.0
|
||||
|
||||
Reference in New Issue
Block a user