Introduction
This article aims at fixing common python errors.
STS10.3.2 and STS10.4
If Python not properly set, you can get this error when tail -f /var/log/systran/translation-resources/*
nslation-resource-monitor/workspace/2ea3cb4e-18c8-460a-a917-1967af323df1/data/env3.9/bin/systran-pte-server'
log-tr-bbee79e1-8ba7-42b3-ba79-001f6a1736c9-instance-dcb0a14f-d840-4a4a-9796-f11cded17f0f-err.txt:FileNotFoundError: [Errno 2] No such file or directory: b'/opt/systran/translation-resource-monitor/workspace/2ea3cb4e-18c8-460a-a917-1967af323df1/data/env3.9/bin/systran-pte-server'Ensure python3 alias is set to python 3.9:
cd /etc/alternatives
ll python*If not, adjust:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
or
ln -s python3 /usr/bin/python
/!\ Then you need to reinstall the translation resources
STS10.0 and STS10.1
If Python not properly set, you can get this error when tail -f /var/log/systran/translation-resources/*
Sep 05 10:07:19 XXXXXX TranslationResourceMonitor[2438372]: 2024-Sep-05 10:07:19.755287 UTC [TRM] ERROR ModuleNotFoundError: No module named 'requests'Ensure python3 alias is set to python 3.9:
# /usr/bin/env python3 --version
Python 3.9.xIf not, adjust:
alternatives --set python3 /usr/bin/python3.9or
update-alternatives --set python3 /usr/bin/python3.9Ensure whereis python give you a path to a binary:
# whereis python
python: /usr/bin/pythonIf not:
ln -s /usr/bin/python3 /usr/bin/python
SPN9
Before upgrading your engine to the latest version, kindly ensure your python alias is correct.
What error should I face if I d not have the right alias?
Your PTE component may crash loop and you get the following errors in the /var/log/systran/translation-resources/* files
/usr/bin/env: 'python': No such file or directoryor
/usr/bin/python: 'python': No such file or directory
How do I fix this?
Run the followig script (as root):
if [ -f /usr/bin/python3 ]; then
echo "Activate python3"
sudo alternatives --set python /usr/bin/python3 || alternatives --config python3
[ ! -f /usr/bin/python ] && sudo ln -s /usr/bin/python3 /usr/bin/python
else
echo "Activate python2"
sudo alternatives --set python /usr/bin/python2
[ ! -f /usr/bin/python ] && sudo ln -s /usr/bin/python2 /usr/bin/python
fi
What if still doesnt work?
If error message is: /usr/bin/env: 'python2': No such file or directory, then you will have to upgrade your Common PTE to a version >= 9.13.0