Open argosopentech opened 11 months ago
I get the same error when trying to install a newer version
does not work with this user
only skip the part of adding the user
and in the libretranslate.service file
user and group = root
and in nginx = the ip of the server
and it should work
solution 2
create dir in /home/libretranslate/db
ready
No, this does not solve it. I created directory /home/libretranslate/db (but there is one in /home/libretranslate/LibreTranslate/db already, where it should be).
I cannot skip part of adding user, because it is installed in python venv and not in root.
OK, this is how i got the update working (note that it is now running under root venv and not libretranslate user anymore):
su libretranslate
sudo systemctl stop libretranslate
cp /root/libretranslate/LibreTranslate/libretranslate/templates/index.html /tmp/index.html
rm -rf ~/LibreTranslate
exit
git clone https://github.com/LibreTranslate/LibreTranslate.git ~/LibreTranslate
virtualenv ~/LibreTranslate/env
~/LibreTranslate/env/bin/pip install gunicorn
~/LibreTranslate/env/bin/pip install ~/LibreTranslate/ --no-cache-dir
~/LibreTranslate/env/bin/pip uninstall beautifulsoup4
~/LibreTranslate/env/bin/pip install beautifulsoup4==4.9.3
~/LibreTranslate/env/bin/libretranslate
nano /etc/systemd/system/libretranslate.service
edit and change user/path from /home/libretranslate to /root (don't forget to adapt to your url!):
[Unit]
Description=LibreTranslate WSGI with Gunicorn and Nginx
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/root/LibreTranslate
Environment="PATH=/root/LibreTranslate/env/bin"
ExecStart=/root/LibreTranslate/env/bin/gunicorn --workers 3 --bind unix:libretranslate.sock -m 007 wsgi:app(api_keys=True, req_limit="5", batch_limit="2", get_api_key_link="https://translate.somedomain.com/get-api-key")
Restart=always
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=mixed
TimeoutStopSec=1
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
cp /tmp/index.html /root/LibreTranslate/libretranslate/templates/index.html
systemctl start libretranslate
systemctl enable libretranslate
nano /etc/nginx/sites-available/default
Also change home to root here (don't forget to adapt to your url!):
server {
listen 80;
server_name localhost translate.someserver.com;
location / {
include proxy_params;
proxy_pass http://unix:/root/LibreTranslate/libretranslate.sock;
}
}
nginx -t
systemctl restart nginx
for future updates just skip the first line (and later the "exit" command).
PS: it may be necessary to run nginx as root for this to work.
creating the directory /home/libretranslate/db does not allow the installation. Is there a real solution?
"Building wheels for collected packages: libretranslate
Building wheel for libretranslate (PEP 517) ... done
Created wheel for libretranslate: filename=libretranslate-1.5.5-py3-none-any.whl size=632627 sha256=d033f1f7e2f116978093177884054b4ab380fa804c6a953244b27a7bb2e9d4a9
Stored in directory: /tmp/pip-ephem-wheel-cache-bw64ejsg/wheels/6f/7f/9d/b7e065cb8e7956f9224c87b27cc2e1e3ceb2b4b85ae421755b
Successfully built libretranslate
Installing collected packages: libretranslate
Attempting uninstall: libretranslate
Found existing installation: libretranslate 1.5.5
Uninstalling libretranslate-1.5.5:
Successfully uninstalled libretranslate-1.5.5
Successfully installed libretranslate-1.5.5
Traceback (most recent call last):
File "/home/libretranslate/LibreTranslate/env/bin/libretranslate", line 8, in
please add this to /etc/sudoers.d/libretranslate
libretranslate ALL=NOPASSWD: /usr/local/bin/libretranslate
here my systemd service
root@debian:/etc/systemd/system# cat libretranslate.service
[Unit]
Description=LibreTranslate
After=network.target
[Service]
User=libretranslate
Group=libretranslate
WorkingDirectory=/opt/libretranslate/
ExecStart=sudo -u libretranslate /usr/local/bin/libretranslate --host 127.0.0.1 --port 5000
#--disable-files-translation
Restart=always
#CPUQuota=50%
[Install]
WantedBy=multi-user.target
Debian 12.
root@libretranslate:~# su libretranslate $ ~/LibreTranslate-init/setup.sh
Loaded support for 44 languages (88 models total)!
Traceback (most recent call last):
File "/home/libretranslate/LibreTranslate/env/bin/libretranslate", line 8, in
I sometimes see this error but it doesn't seem to cause issues.