July 7, 2024

Install and run Libretranslate on your computer

Download and extract Libretranslate files:

~/bin$ wget https://github.com/LibreTranslate/LibreTranslate/archive/refs/tags/v1.6.0.tar.gz
~/bin$ tar -xvzf LibreTranslate-1.6.0.tar.gz -C libretranslate/

Note: check for the latest release there: https://github.com/LibreTranslate/LibreTranslate/releases

I thought I had docker installed so I followed the instructions in the README and ran:

$ ./run.sh 

which prompted:

Checking for docker...   can't find docker! Check that the program is installed and that you have added the proper path to the program to your PATH environment variable before launching the program. If you change your PATH environment variable, remember to close and reopen your terminal. https://www.docker.com/

On the forum of Trisquel, a user wrote that one can install Docker on Trisquel by installing the package docker.io. So I ran:

$ sudo apt install docker.io

I did not install the repository of Docker, as suggested on Docker’s website, because Docker incorporates non-free programmes in its products.

Once I had ran the install command, I verified that the Docker Engine installation was successful by running the hello-world image1:

sudo docker run hello-world

which printed:

Hello from Docker!
This message shows that your installation appears to be working correctly.

I tried to run Libretranslate again:

Checking for docker...   found
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

I searched on the web for docker /var/run/docker.sock connect: permission denied” and read on Docker’s forum that permission of the docker.sock should look like2:

srw-rw---- 1 root docker 0 xxx  x xx:xx /var/run/docker.sock

I checked on my system:

$ ls -l /var/run/docker.sock 
srw-rw---- 1 root docker 0 Jul  7 09:47 /var/run/docker.sock

I read around and found that the issue might be related to user not belonging to the group.

I found this command to check users of a group:

$ grep docker /etc/group

which I am assuming is saying that there is no user in the group.

I found the command:

$ sudo usermod -a -G docker $USER

to add a user to a (or the?) docker group.

I checked if $USER was added:

$ grep docker /etc/group

It worked.

Then I ran:

$ newgrp docker

to take change into consideration (instead of rebooting my computer).

Then, to set up Libretranslate, you can run ./run.sh, but this command alone will download Libretranslate’s 80+ languages.

If you only want to download a selection of languages run:

$ ./run.sh --load-only en,es,fr,de,it --update-models

for example.

  1. https://docs.docker.com/engine/install/ubuntu/↩︎

  2. https://forums.docker.com/t/permission-for-v-var-run-docker-sock/132976/2↩︎

personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki docker libretranslate offline

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88