Fix user site-packages not loading when running as root/sudo

Explicitly adds user site-packages to sys.path when ENABLE_USER_SITE
is disabled, allowing pip-installed packages like skyfield to be found.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
James Smith
2025-12-22 12:14:10 +00:00
parent e073d8ba47
commit 62fc3a8f2c
+6 -9
View File
@@ -14,16 +14,13 @@ Requires RTL-SDR hardware for RF modes.
"""
import sys
print(f"[Debug] Python executable: {sys.executable}")
print(f"[Debug] Python version: {sys.version}")
print(f"[Debug] User site-packages: {'/home/radio/.local/lib/python3.10/site-packages' in sys.path}")
import site
# Quick skyfield check at startup
try:
import skyfield
print(f"[Debug] Skyfield loaded: {skyfield.__file__}")
except Exception as e:
print(f"[Debug] Skyfield import failed: {e}")
# Ensure user site-packages is available (may be disabled when running as root/sudo)
if not site.ENABLE_USER_SITE:
user_site = site.getusersitepackages()
if user_site and user_site not in sys.path:
sys.path.insert(0, user_site)
import subprocess
import shutil