Introduction
This article aims at fixing common python errors.
STS10.0 and STS10.1
Ensure python3 alias is set to pyton 3.9:
# /usr/bin/env python3 --version
Python 3.9.x
If not, adjust:
alternatives --set python3 /usr/bin/python3.9
If not properly set, you can get this error:
Sep 05 10:07:19 XXXXXX TranslationResourceMonitor[2438372]: 2024-Sep-05 10:07:19.755287 UTC [TRM] ERROR ModuleNotFoundError: No module named 'requests'
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 directory
or
/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