update old post (libretranslate)

This commit is contained in:
Dominic Reich 2025-01-06 16:16:13 +01:00
parent 91e1584f2c
commit c6dee5160c
Signed by: dominic
GPG key ID: 0B5787DB23049C45

View file

@ -7,7 +7,7 @@ summary: >
my own use case. The thumbnail is a trademark of my own use case. The thumbnail is a trademark of
[LibreTranslate](https://github.com/LibreTranslate/LibreTranslate/blob/main/TRADEMARK.md).</small> [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate/blob/main/TRADEMARK.md).</small>
date: 2024-12-07T07:22:28+01:00 date: 2024-12-07T07:22:28+01:00
lastmod: 2024-12-08T12:40:21+0000 lastmod: 2025-01-06T15:16:13+0000
categories: categories:
- computerstuff - computerstuff
tags: tags:
@ -27,18 +27,23 @@ single-user instance has to do.
## Preface / preparations ## Preface / preparations
But for the installation of LibreTranslate I enhanced (after powering off the VM) 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 <kbd>/tmp</kbd> While installing the needed python packages I ran out of space on the <kbd>/tmp</kbd>
filesystem (which was just a <kbd>tmpfs</kbd> filesystem). We could increase the filesystem (which was just a <kbd>tmpfs</kbd> filesystem).
RAM to 10GB or 12GB but for me it worked by only using 8GB of RAM for this VM.
### Modify <kbd>/etc/fstab</kbd> and increase <kbd>/tmp</kbd> ### Modify <kbd>/etc/fstab</kbd> and increase <kbd>/tmp</kbd>
To increase <kbd>/tmp</kbd> we log into the VM and modify the file <kbd>/etc/fstab</kbd>. To increase <kbd>/tmp</kbd> we log into the VM and modify the file <kbd>/etc/fstab</kbd>.
```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 ### Install some needed packages
@ -57,16 +62,39 @@ $ paru -S cmake
$ sudo useradd --create-home --home-dir /var/lib/libretranslate libretranslate $ 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 ```console
$ sudo su - libretranslate $ sudo su - libretranslate
$ python -m venv venv $ python3.11 -m venv venv
$ source venv/bin/activate $ source venv/bin/activate
$ pip install --prefer-binary libretranslate $ pip install --prefer-binary libretranslate
$ argospm update $ 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 <module>
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 ### Install every language possible
```console ```console
@ -143,7 +171,7 @@ $ sudo systemctl restart mastodon-web.service
Comment or remove the line in <kbd>/etc/fstab</kbd> Comment or remove the line in <kbd>/etc/fstab</kbd>
```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 ## Reduce the VMs specs back to normal