File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -441,6 +441,8 @@ def _get_venv_root(self) -> Path:
441441
442442 CRITICAL: When running from a managed interpreter (e.g., inside .omnipkg/interpreters/),
443443 we must find the ORIGINAL venv root, not create nested structures.
444+
445+ NEW: For system Python (no venv), use ~/.local/omnipkg instead of sys.prefix
444446 """
445447 override = os.environ.get("OMNIPKG_VENV_ROOT")
446448 if override:
@@ -502,6 +504,18 @@ def _get_venv_root(self) -> Path:
502504 return search_dir
503505 search_dir = search_dir.parent
504506
507+ # ============================================================================
508+ # NEW FIX: For system Python (no venv found), use user directory
509+ # ============================================================================
510+ # Check if we're using system Python (in /usr, /usr/local, etc.)
511+ is_system_python = str(current_executable).startswith(('/usr/', '/usr/local/', '/opt/'))
512+
513+ if is_system_python:
514+ # Use user-local directory instead of sys.prefix
515+ safe_user_dir = Path.home() / ".local" / "omnipkg"
516+ safe_user_dir.mkdir(parents=True, exist_ok=True)
517+ return safe_user_dir
518+
505519 # Only use sys.prefix as a last resort if all else fails.
506520 return Path(sys.prefix)
507521
You can’t perform that action at this time.
0 commit comments