McCloudS / subgen

Autogenerate subtitles using OpenAI Whisper Model via Jellyfin, Plex, Emby, Tautulli, or Bazarr
MIT License
532 stars 48 forks source link

Docker-compose issue #29

Closed notarobot63 closed 9 months ago

notarobot63 commented 9 months ago

Hello, The Docker build does not seems to end, Here are the last lines of the logs:

whisper has been successfully installed.

Traceback (most recent call last):

  File "/subgen/./subgen.py", line 40, in <module>

    import stable_whisper

ModuleNotFoundError: No module named 'stable_whisper'

Any idea ?

McCloudS commented 9 months ago

I don't... the Dockerfile currently builds fine and stable-ts is the package that needs 'import stable_whisper'. Are you building the dockerfile or pulling it from dockerhub (via docker-compose)? My only guess if you're building it yourself could be non-amd64 architecture throwing issues.

notarobot63 commented 9 months ago

I'm pulling from docker-compose on a debian x64 VM.

-------- Message d'origine -------- Le 14 nov. 2023, 17:30, McCloudS a écrit :

I don't... the Dockerfile currently builds fine and stable-ts is the package that needs 'import stable_whisper'. Are you building the dockerfile or pulling it from dockerhub (via docker-compose)? My only guess if you're building it yourself could be non-amd64 architecture throwing issues.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

McCloudS commented 9 months ago

That doesn't appear to be a dockerfile/docker-compose issue but an issue when the script is actually executed on start. For whatever reason, that implies that the installation of stable-ts is failing. You can try manually doing pip3 install stable-ts and see if it installs correctly. I pulled a fresh image and mine spins up immediately with no issue.

https://github.com/McCloudS/subgen/blob/4db4046017e4a47330c4f7e5a96e2d2b1ff06d4e/subgen/subgen.py#L29 installs all the packages necessary on script startup (packages listed starting at line 17).

McCloudS commented 9 months ago

After thinking more... I would guess your python packages are being saved in the wrong place or something. If you have a similar line to - "{APPDATA}/subgen/dist-packages:/usr/local/lib/python3.10/dist-packages" in your docker-compose, I would remove it or make sure it actually maps to your configuration correctly.

The default docker-compose requires you to update paths to match your configuration.

notarobot63 commented 9 months ago

I removed this line: same issue...

-------- Message d'origine -------- Le 14 nov. 2023, 18:11, McCloudS a écrit :

After thinking more... I would guess your python packages are being saved in the wrong place or something. If you have a similar line to - "{APPDATA}/subgen/dist-packages:/usr/local/lib/python3.10/dist-packages" in your docker-compose, I would remove it.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

McCloudS commented 9 months ago

Open up a bash/shell on the image and try manually installing the packages and see what's happening. You're failing on the first import of an installed package, which is either showing the install failed or it's not where it thinks it is.

notarobot63 commented 9 months ago

I'll try tomorrow and let you know, thanks!

-------- Message d'origine -------- Le 14 nov. 2023, 18:18, McCloudS a écrit :

Open up a bash/shell on the image and try manually installing the packages and see what's happening. You're failing on the first import of an installed package, which is either showing the install failed or it's not where it thinks it is.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

McCloudS commented 9 months ago

Spun up the same image on a different machine, fresh install. No errors.

notarobot63 commented 9 months ago

That's really weird, I tried with cpu or latest branches still the same: Here is the docker-compose if that can help:


version: '2'
services:
  subgen:
    container_name: subgen
    tty: true
    image: mccloud/subgen:latest
    environment:
       - "WHISPER_MODEL=medium"
       - "WHISPER_THREADS=4"
       - "PROCADDEDMEDIA=True"
       - "PROCMEDIAONPLAY=False"
       - "NAMESUBLANG=aa"
       - "SKIPIFINTERNALSUBLANG=fra"
       - "JELYFINTOKEN=token here"
       - "JELLYFINSERVER=http://jellyfin:8096"
       - "WEBHOOKPORT=8090"
       - "CONCURRENT_TRANSCRIPTIONS=2"
       - "WORD_LEVEL_HIGHLIGHT=False"
       - "DEBUG=True"
       - "USE_PATH_MAPPING=False"
       - "PATH_MAPPING_FROM=/tv"
       - "PATH_MAPPING_TO=/Volumes/TV"
       - "TRANSCRIBE_DEVICE=cpu"
       - "MODEL_PATH=."
    volumes:
       - "./tv:/tv"
    ports:
       - "8090:8090"
McCloudS commented 9 months ago

My last guess would be that your container doesn't have a valid network configuration and/or internet connection. So when it tries to download the packages, they all fail, and so it can't import them. You could troubleshoot by watching the output of the script run on container start, or getting a shell and trying to install the packages manually.

See: https://docs.docker.com/compose/networking/

notarobot63 commented 9 months ago

The container has Internet access and downloads the packages without problem. Anyway I skipped the docker way and used the script straight from the VM and it works, I guess there's an issue with the docker images or whatever. Great job anyway !

McCloudS commented 9 months ago

Thanks, just wish I knew what the problem was.  I use the container in a couple different places and it has just under 900 downloads.