From c6dee5160c347f4e13c86ee4cf7d5793a7e8044d Mon Sep 17 00:00:00 2001 From: Dominic Reich Date: Mon, 6 Jan 2025 16:16:13 +0100 Subject: [PATCH] update old post (libretranslate) --- .../2024/73-install-libretranslate/index.md | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/content/posts/2024/73-install-libretranslate/index.md b/content/posts/2024/73-install-libretranslate/index.md index d8f43c9..e676393 100644 --- a/content/posts/2024/73-install-libretranslate/index.md +++ b/content/posts/2024/73-install-libretranslate/index.md @@ -7,7 +7,7 @@ summary: > my own use case. The thumbnail is a trademark of [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate/blob/main/TRADEMARK.md). date: 2024-12-07T07:22:28+01:00 -lastmod: 2024-12-08T12:40:21+0000 +lastmod: 2025-01-06T15:16:13+0000 categories: - computerstuff tags: @@ -27,18 +27,23 @@ single-user instance has to do. ## Preface / preparations But for the installation of LibreTranslate I enhanced (after powering off the VM) -the cores to 4 and the RAM to 8GB. +the cores to 4 and the RAM to 10GB. While installing the needed python packages I ran out of space on the /tmp -filesystem (which was just a tmpfs filesystem). We could increase the -RAM to 10GB or 12GB but for me it worked by only using 8GB of RAM for this VM. +filesystem (which was just a tmpfs filesystem). ### Modify /etc/fstab and increase /tmp To increase /tmp we log into the VM and modify the file /etc/fstab. ```fstab -tmpfs /tmp tmpfs size=6G,nr_inodes=10k 0 0) +tmpfs /tmp tmpfs size=10G 0 0 +``` + +Alternatively you can use another directory with more space as tmp storage: + +```console +$ TMPDIR=/var/lib/libretranslate/tmp pip install --prefer-binary libretranslate ``` ### Install some needed packages @@ -57,16 +62,39 @@ $ paru -S cmake $ sudo useradd --create-home --home-dir /var/lib/libretranslate libretranslate ``` -Change to the new user: +Change to the new user and install libretranslate in a virtual environment: + +(I had problems with Python 3.12 so I'll stick with 3.11 for now) ```console $ sudo su - libretranslate -$ python -m venv venv +$ python3.11 -m venv venv $ source venv/bin/activate $ pip install --prefer-binary libretranslate $ argospm update ``` +**Update:** You get an error similar to this one? + +```console +(venv) [libretranslate@mastodon ~]$ pip install --prefer binary libretranslate +Traceback (most recent call last): + File "/var/lib/libretranslate/venv/bin/pip", line 5, in + from pip._internal.cli.main import main +ModuleNotFoundError: No module named 'pip' +``` + +Most of the time this is because symlinks of python got updated and you haven't +installed all the modules on the new versions venv. +I solved this with a new installation on the new version, there might be easier +ways but I haven't found the time to look into that yet. + +So I install pip again and repeat the installation within the new python versions venv. + +```console +$ python -m ensurepip +``` + ### Install every language possible ```console @@ -143,7 +171,7 @@ $ sudo systemctl restart mastodon-web.service Comment or remove the line in /etc/fstab ```fstab -#tmpfs /tmp tmpfs size=6G,nr_inodes=10k 0 0) +#tmpfs /tmp tmpfs size=10G 0 0 ``` ## Reduce the VMs specs back to normal