Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to download models when using docker #332

Closed
alpap opened this issue Oct 24, 2022 · 10 comments
Closed

Unable to download models when using docker #332

alpap opened this issue Oct 24, 2022 · 10 comments
Labels
question Further information is requested

Comments

@alpap
Copy link

alpap commented Oct 24, 2022

Found 56 models
Downloading Arabic → English (1.0) ...
(URLError(ConnectionRefusedError(111, 'Connection refused')),)
(URLError(ConnectionRefusedError(111, 'Connection refused')),)
(URLError(ConnectionRefusedError(111, 'Connection refused')),)

@pierotofy
Copy link
Member

Hey @alpap 👋 are you connected directly through the internet or via VPN? It looks like a network configuration error or a firewall issue, not a bug in LibreTranslate per-se.

@pierotofy pierotofy added the question Further information is requested label Oct 26, 2022
@Alumniminium
Copy link

Alumniminium commented Nov 4, 2022

I'm having the same issue. In my case its error 110

(URLError(TimeoutError(110, 'Connection timed out')),)
(URLError(TimeoutError(110, 'Connection timed out')),)

I pulled the container and that's all I see when I run it.

Edit: Ah, i see my disk is filling up. It's downloading alot. How do I chose which languages I want?

@PJ-Finlay
Copy link
Contributor

How do I chose which languages I want?

--load-only en,es,fr,de

@grigio
Copy link

grigio commented Nov 12, 2022

I'm having the same issue with this docker-compose.yml

version: "3"

services:
  libretranslate:
    container_name: libretranslate
    image: libretranslate/libretranslate
    restart: unless-stopped
    ports:

@grigio
Copy link

grigio commented Nov 12, 2022

I also get this in the logs

libretranslate  |   File "/usr/local/lib/python3.8/os.py", line 213, in makedirs
libretranslate  |     makedirs(head, exist_ok=exist_ok)
libretranslate  |   File "/usr/local/lib/python3.8/os.py", line 223, in makedirs
libretranslate  |     mkdir(name, mode)
libretranslate  | PermissionError: [Errno 13] Permission denied: '/home/libretranslate/.local'


@selfagency
Copy link

i'm having the same problem without docker

@jspablo
Copy link

jspablo commented Nov 15, 2022

Probably this issue is related #344 (comment), using an older release tag doesn't fix it, looks like a problem with install_models.py step building the docker image

@soletan
Copy link

soletan commented Nov 17, 2022

It feels like the whole readme is rather bogus. I was spending all day trying to get this app running and still haven't succeeded (and this isn't the first docker/python application I'm trying to install).

@grigio Your case is similar to one I was having. The containerized version seems to have issues in case you've bind-mounted that folder. Probably granting full write permissions might help there. Good to know, that local files aren't stored in /root/.local as stated in the readme but in a separate user's home.

Apart from that, I haven't succeeded with creating an API keys database file in container either. No matter what I try, I either run into similar issues with permissions or mounted folders being wrong or any tool failing to access a database file I have to create externally first for the container image has pretty limited tooling though consuming 3.5+ GB which is about 30 times as much disk space as do most web applications based on alpine images.

UPDATE: Some additions on what I've tried:

  • install without docker as instructed, though had to install pip, pkg-config and libicu-dev on a Ubuntu 22.04 host first
  • tried the same on a system with sufficient RAM for the process got killed (I assume OOM) before, succeeded on build there, then I was facing different issues (app was crashing on start on a freshly set up vServer)
  • tried installing with docker
    • with network_mode set to "host" to exclude issues with bridging traffic
    • with fetching limited set of locales

Currently, I have a docker-compose.yml like

version: "3.8"

services:
  lt:
    image: libretranslate/libretranslate
    container_name: lt
    ports:
      - "127.0.0.1:5000:5000"
    command: --api-keys

on a dedicated server with 6 cores/12 threads and 64 GB RAM so I guess resources aren't the issue anymore. The service is running for 34 minutes now and all I see with docker compose logs is:

lt  | (URLError(TimeoutError(110, 'Connection timed out')),)
lt  | (URLError(TimeoutError(110, 'Connection timed out')),)
lt  | (URLError(TimeoutError(110, 'Connection timed out')),)
lt  | (URLError(TimeoutError(110, 'Connection timed out')),)
lt  | (URLError(TimeoutError(110, 'Connection timed out')),)
lt  | (URLError(TimeoutError(110, 'Connection timed out')),)
lt  | (URLError(TimeoutError(110, 'Connection timed out')),)
lt  | (URLError(TimeoutError(110, 'Connection timed out')),)

@soletan
Copy link

soletan commented Nov 17, 2022

Looking better now. This my finally working definition, though I doubt any change was fixing issues with fetching the models in particular. I assume those issues are temporary ones and probably some of them are even warnings one can ignore.

version: "3.8"

services:
  lt:
    image: libretranslate/libretranslate
    container_name: lt
    ports:
      - "127.0.0.1:5000:5000"
    command: --api-keys --api-keys-db-path=/home/libretranslate/.local/db/api_keys.db
    restart: always
    volumes:
      - lt-db:/home/libretranslate/.local/db
      - lt-cache:/home/libretranslate/.local/cache
      - lt-share:/home/libretranslate/.local/share

volumes:
  lt-db:
  lt-cache:
  lt-share:

Before starting this, you should adjust permissions on those volumes' roots.

docker run -it -v root_lt-db:/data alpine chown 1032 /data
docker run -it -v root_lt-share:/data alpine chown 1032 /data
docker run -it -v root_lt-cache:/data alpine chown 1032 /data

Full names of volumes (e.g. root_lt-share) may be different in your case, so check with docker volume ls first. After that, it just takes time to populate the folders. Just use curl and wait for the web frontend to respond.

Add API keys like this:

docker compose exec lt venv/bin/ltmanage keys --api-keys-db-path /home/libretranslate/.local/db/api_keys.db add 120

UPDATE: FWIW, in my case there is caddy as frontend:

  • install on host

  • adjust /etc/caddy/Caddyfile to read similar to this:

    foo.example.com
    reverse_proxy localhost:5000
    
  • restart with systemctl restart caddy

@pierotofy
Copy link
Member

#366 addresses the issue of persistent models/API keys. Use run.sh and things should go smoothly. 🥂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants