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

mimic3 Docker Image on Podman: PermissionError: [Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices' #8

Open
georgmangold opened this issue Jul 1, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@georgmangold
Copy link

Describe the bug
When using the Docker image with Podman, I get a permisson error when opening the local web page an site is not working.

To Reproduce

  1. Follow the instructions https://mycroft-ai.gitbook.io/docs/mycroft-technologies/mimic-tts/mimic-3#docker-image but with Podman

  2. Launch container with Podman from CLI
    2a .With local mount option
    $ podman run -it -p 127.0.0.1:59125:59125 -v /home/user/.local/share/mycroft/mimic3:/home/mimic3/.local/share/mycroft/mimic3 mycroftai/mimic3
    2b. OR without local mount
    $ podman run -it -p 127.0.0.1:59125:59125 mycroftai/mimic3

  3. Go to the local web page at http://localhost:59125/ and see the error message in the CLI

Expected behavior
No Error Message

Log files

$ podman run -it -p 127.0.0.1:59125:59125 -v /home/USER/.local/share/mycroft/mimic3:/home/mimic3/.local/share/mycroft/mimic3 mycroftai/mimic3
INFO:__main__:Starting web server
[2022-07-01 18:17:56 +0000] [1] [INFO] Running on http://0.0.0.0:59125 (CTRL + C to quit)
INFO:hypercorn.error:Running on http://0.0.0.0:59125 (CTRL + C to quit)
ERROR:mimic3_http.app:[Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices'
Traceback (most recent call last):
  File "/home/mimic3/app/.venv/lib/python3.9/site-packages/quart/app.py", line 1512, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/home/mimic3/app/.venv/lib/python3.9/site-packages/quart/app.py", line 1557, in dispatch_request
    return await self.ensure_async(handler)(**request_.view_args)
  File "/home/mimic3/app/mimic3_http/app.py", line 241, in api_voices
    voices_by_key = {v.key: v for v in _MIMIC3.get_voices()}
  File "/home/mimic3/app/mimic3_http/app.py", line 241, in <dictcomp>
    voices_by_key = {v.key: v for v in _MIMIC3.get_voices()}
  File "/home/mimic3/app/mimic3_tts/tts.py", line 195, in get_voices
    for lang_dir in voices_dir.iterdir():
  File "/usr/lib/python3.9/pathlib.py", line 1149, in iterdir
    for name in self._accessor.listdir(self):
PermissionError: [Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices'

Environment:

  • Device type: Laptop
  • OS: Fedora Silverblue 36
  • mycroftai/mimic3
  • Other versions: podman version 4.1.1

Additional context/ Workaround/ Fix:
I was able to fix the error by logging into the container as root, creating the directories, and setting the owner and group to mimic3

podman exec -u 0 -it sad_lalande bash
mkdir -p /home/mimic3/.local/share/mycroft/mimic3
chown -R mimic3:mimic3 .local

@georgmangold georgmangold added the bug Something isn't working label Jul 1, 2022
@rezzorix
Copy link

rezzorix commented Jul 2, 2022

Had the same issue - thanks @georgmangold for the workaround.

@synesthesiam
Copy link
Collaborator

I've added this to the README. Before running for the first time, you need to:

mkdir -p "${HOME}/.local/share/mycroft/mimic3"
chmod a+rwx "${HOME}/.local/share/mycroft/mimic3"

The docker container runs as a different user, so it can't write to the .local directory without permission.

@georgmangold
Copy link
Author

georgmangold commented Jul 2, 2022

Unfortunately that did not work for me. Maybe the problem is still that I'm trying it with Podman instead of Docker? If someone can verify that it works for them too.
As seen in the Dockerfile, the default language en_UK/apope_low is loaded from /usr/share/mycroft/mimic3/voices/en_UK/apope_low without problems. See last line.
INFO:mimic3_tts.tts:Loaded voice from /usr/share/mycroft/mimic3/voices/en_UK/apope_low

[georg@georg ~]$ rm -rf ~/.local/share/mycroft
[georg@georg ~]$ mkdir -p "${HOME}/.local/share/mycroft/mimic3"
[georg@georg ~]$ chmod a+rwx "${HOME}/.local/share/mycroft/mimic3"
[georg@georg ~]$ docker run \
       -it \
       -p 59125:59125 \
       -v "${HOME}/.local/share/mycroft/mimic3:/home/mimic3/.local/share/mycroft/mimic3" \
       'mycroftai/mimic3'
INFO:__main__:Starting web server
[2022-07-02 15:59:41 +0000] [1] [INFO] Running on http://0.0.0.0:59125 (CTRL + C to quit)
INFO:hypercorn.error:Running on http://0.0.0.0:59125 (CTRL + C to quit)
ERROR:mimic3_http.synthesis:Error during inference
Traceback (most recent call last):
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mimic3/.local/share/mycroft/mimic3/voices/de_DE/m-ailabs_low'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mimic3/.local/share/mycroft/mimic3/voices/de_DE'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 125, in do_synthesis_proc
    result = do_synthesis(item, mimic3)
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 81, in do_synthesis
    raise e
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 61, in do_synthesis
    mimic3.speak_text(params.text, text_language=params.text_language)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 368, in speak_text
    voice = self._get_or_load_voice(self.voice)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 553, in _get_or_load_voice
    maybe_model_dir = self._download_voice(voice_key)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 605, in _download_voice
    download_voice(
  File "/home/mimic3/app/mimic3_tts/download.py", line 86, in download_voice
    voice_dir.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1316, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1316, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices'
ERROR:mimic3_http.app:[Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices'
Traceback (most recent call last):
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mimic3/.local/share/mycroft/mimic3/voices/de_DE/m-ailabs_low'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mimic3/.local/share/mycroft/mimic3/voices/de_DE'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mimic3/app/.venv/lib/python3.9/site-packages/quart/app.py", line 1512, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/home/mimic3/app/.venv/lib/python3.9/site-packages/quart/app.py", line 1557, in dispatch_request
    return await self.ensure_async(handler)(**request_.view_args)
  File "/home/mimic3/app/mimic3_http/app.py", line 225, in app_tts
    wav_bytes = await text_to_wav(
  File "/home/mimic3/app/mimic3_http/app.py", line 102, in text_to_wav
    wav_bytes = await future
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 125, in do_synthesis_proc
    result = do_synthesis(item, mimic3)
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 81, in do_synthesis
    raise e
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 61, in do_synthesis
    mimic3.speak_text(params.text, text_language=params.text_language)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 368, in speak_text
    voice = self._get_or_load_voice(self.voice)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 553, in _get_or_load_voice
    maybe_model_dir = self._download_voice(voice_key)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 605, in _download_voice
    download_voice(
  File "/home/mimic3/app/mimic3_tts/download.py", line 86, in download_voice
    voice_dir.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1316, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1316, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices'
ERROR:mimic3_http.synthesis:Error during inference
Traceback (most recent call last):
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mimic3/.local/share/mycroft/mimic3/voices/de_DE/m-ailabs_low'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mimic3/.local/share/mycroft/mimic3/voices/de_DE'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 125, in do_synthesis_proc
    result = do_synthesis(item, mimic3)
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 81, in do_synthesis
    raise e
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 61, in do_synthesis
    mimic3.speak_text(params.text, text_language=params.text_language)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 368, in speak_text
    voice = self._get_or_load_voice(self.voice)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 553, in _get_or_load_voice
    maybe_model_dir = self._download_voice(voice_key)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 605, in _download_voice
    download_voice(
  File "/home/mimic3/app/mimic3_tts/download.py", line 86, in download_voice
    voice_dir.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1316, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1316, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices'
ERROR:mimic3_http.app:[Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices'
Traceback (most recent call last):
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mimic3/.local/share/mycroft/mimic3/voices/de_DE/m-ailabs_low'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/mimic3/.local/share/mycroft/mimic3/voices/de_DE'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mimic3/app/.venv/lib/python3.9/site-packages/quart/app.py", line 1512, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/home/mimic3/app/.venv/lib/python3.9/site-packages/quart/app.py", line 1557, in dispatch_request
    return await self.ensure_async(handler)(**request_.view_args)
  File "/home/mimic3/app/mimic3_http/app.py", line 225, in app_tts
    wav_bytes = await text_to_wav(
  File "/home/mimic3/app/mimic3_http/app.py", line 102, in text_to_wav
    wav_bytes = await future
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 125, in do_synthesis_proc
    result = do_synthesis(item, mimic3)
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 81, in do_synthesis
    raise e
  File "/home/mimic3/app/mimic3_http/synthesis.py", line 61, in do_synthesis
    mimic3.speak_text(params.text, text_language=params.text_language)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 368, in speak_text
    voice = self._get_or_load_voice(self.voice)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 553, in _get_or_load_voice
    maybe_model_dir = self._download_voice(voice_key)
  File "/home/mimic3/app/mimic3_tts/tts.py", line 605, in _download_voice
    download_voice(
  File "/home/mimic3/app/mimic3_tts/download.py", line 86, in download_voice
    voice_dir.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1316, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1316, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/home/mimic3/.local/share/mycroft/mimic3/voices'
INFO:mimic3_tts.tts:Loaded voice from /usr/share/mycroft/mimic3/voices/en_UK/apope_low

[georg@georg ~]$ ls -la .local/share/mycroft/
insgesamt 4
drwxrwxr-x. 1 georg georg  12  2. Jul 18:10 .
drwx------. 1 georg georg 616  2. Jul 18:10 ..
drwxrwxrwx. 1 georg georg   0  2. Jul 18:10 mimic3

[georg@georg ~]$ docker exec -it boring_davinci bash
mimic3@556ae41e3045:~$ ls -la .local/share/mycroft/
total 0
drwxr-xr-t. 1 root root 12 Jul  2 16:11 .
drwxr-xr-t. 1 root root 14 Jul  2 16:11 ..
drwxrwxrwx. 1 root root  0 Jul  2 16:10 mimic3
mimic3@556ae41e3045:~$ ls -la .local/share/mycroft/mimic3/
ls: cannot open directory '.local/share/mycroft/mimic3/': Permission denied

[georg@georg ~]$ docker exec -u 0 -it boring_davinci bash
root@556ae41e3045:/home/mimic3# ls -la .local/share/mycroft/
total 0
drwxr-xr-t. 1 root root 12 Jul  2 16:11 .
drwxr-xr-t. 1 root root 14 Jul  2 16:11 ..
drwxrwxrwx. 1 root root  0 Jul  2 16:10 mimic3

root@556ae41e3045:/home/mimic3# ls -la .local/share/mycroft/mimic3/
ls: cannot open directory '.local/share/mycroft/mimic3/': Permission denied

(You may also want to change the "-p 59125:59125" part to "-p 127.0.0.1:59125:59125" so that really only localhost can access it by default.)

@fishscene
Copy link

fishscene commented Jun 30, 2023

Same exact issue, but with docker on Ubuntu.
ALL "English (US)" voices throw this error.

The fix?
#33 (5 months old at the time of this post)

https://github.com/jtabet/mimic3/tree/docker-run-out-of-the-box

My working docker configuration:

version: "3"

services:
  mimic3:
    container_name: mimic3
    hostname: mimic3
    image: jtabet/mimic3 #:latest
    ports:
      - 59125:59125
    volumes:
      - /etc/localtime:/etc/localtime:ro
    environment:
      TZ: 'America/Los_Angeles'

    restart: 'always'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants