Skip to content

Commit e9a47c5

Browse files
authored
fix(computer): give Freestyle desktop computers the system Python with their packages (#6366)
Freestyle's Ubuntu base puts its own Python first on PATH, so python3 in a desktop computer could not import openpyxl, python-docx or python-pptx, which the builder installs into the system Python. Point python and pip in /usr/local/bin at the system ones. Signed-off-by: Jalil <reachjalil@gmail.com>
1 parent aa1c29d commit e9a47c5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎ee/packages/headless-computer/scripts/build-freestyle-desktop-snapshot.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ chmod 0440 /etc/sudoers.d/ubuntu /etc/sudoers.d/openwork-command
9999
mkdir -p /usr/local/share/openwork-computer /usr/local/share/openwork-desktop/scripting /workspace
100100
install -m 0644 $B/requirements-desktop.lock /usr/local/share/openwork-computer/requirements-desktop.lock
101101
bash $B/install-computer.sh
102+
# Freestyle's base puts its own Python first on PATH (/usr/local/bin -> /opt/freestyle/python); the
103+
# computer's packages are in the system Python, so python and pip there must be the system ones.
104+
for name in python python3 python3.12; do ln -sfn /usr/bin/python3 /usr/local/bin/$name; done
105+
for name in pip pip3 pip3.12; do ln -sfn /usr/bin/pip3 /usr/local/bin/$name; done
102106
PLAYWRIGHT_BROWSERS_PATH=/opt/openwork-chromium /usr/local/bin/npx -y playwright@${playwright} install --with-deps chromium
103107
ln -sfn "$(ls -d /opt/openwork-chromium/chromium-*/chrome-linux/chrome | head -n 1)" /usr/local/bin/chromium
104108
chmod -R a+rX /opt/openwork-chromium

0 commit comments

Comments
 (0)