Mimic3 backend couldn't be loaded - Ubuntu 20.04

I installed Mycroft using the git method a few days ago on my Ubuntu 20.04 LTS desktop. Worked great until I tried to install mimic3; now I don’t have any TTS. It fails to load the mimic3 backend and makes no sound when trying to fall back to mimic 1 (I think). Here’s the error I see in /var/log/mycroft/audio.log:

2022-08-14 17:14:20.055 | INFO     | 61043 | mycroft.tts.tts:create:609 | Loaded plugin mimic3_tts_plug
2022-08-14 17:14:20.062 | ERROR    | 61043 | mycroft.tts.tts:create:618 | The selected TTS backend couldn't be loaded. Falling back to Mimic
Traceback (most recent call last):
  File "/home/user/Downloads/mycroft/mycroft-core/mycroft/tts/tts.py", line 613, in create
    tts = clazz(tts_lang, tts_config)
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/mycroft_plugin_tts_mimic3/__init__.py", line 110, in __init__
    self.tts.preload_voice(voice)
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/mimic3_tts/tts.py", line 310, in preload_voice
    self._get_or_load_voice(key_to_load)
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/mimic3_tts/tts.py", line 579, in _get_or_load_voice
    voice = Mimic3Voice.load_from_directory(
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/mimic3_tts/voice.py", line 283, in load_from_directory
    onnx_model = Mimic3Voice._load_model(
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/mimic3_tts/voice.py", line 403, in _load_model
    onnx_model = onnxruntime.InferenceSession(
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 347, in __init__
    self._create_inference_session(providers, provider_options, disabled_optimizers)
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 375, in _create_inference_session
    raise ValueError( 
ValueError: This ORT build has ['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'] enabled. Since ORT 1.9, you are required to explicitly set the providers parameter when instantiating InferenceSession. For example, onnxruntime.InferenceSession(..., providers=['TensorrtExecutionProvider', 'CUDAExecutionProvider', 'CPUExecutionProvider'], ...)

I installed mimic3 following the MycroftAI/plugin-tts-mimic3 instructions. I used mycroft-pip install mycroft-plugin-tts-mimic3 when I got to that step, to install English only. I first tried the Debian package, and now I’m using a mimic3 Docker container.

The mimic3 web UI seems to work at localhost port 59125. I can set it to English and pick any of the voices and it renders audio just fine. It worked when I was using the Debian package, too.

I’m starting the mimic3 Docker container like so:

docker run \
       --rm \
       -it \
       --name mimic3 \
       -p 59125:59125 \
       -v "${HOME}/.local/share/mycroft/mimic3:/home/mimic3/.local/share/mycroft/mimic3" \
       'mycroftai/mimic3'

Here’s the container output:

INFO:__main__:Starting web server
[2022-08-15 00:15:53 +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)
INFO:mimic3_tts.tts:Loaded voice from /home/mimic3/.local/share/mycroft/mimic3/voices/en_US/cmu-arctic_low

Here’s the tts section of my mycroft.conf:

{
  "pulse_duck": false,
  "module": "mimic3_tts_plug",
  "polly": {
    "voice": "Matthew",
    "region": "us-east-1",
    "access_key_id": "",
    "secret_access_key": ""
  },
  "mimic": {
    "voice": "ap"
  },
  "mimic2": {
    "lang": "en-us",
    "url": "https://mimic-api.mycroft.ai/synthesize?text=",
    "preloaded_cache": "/opt/mycroft/preloaded_cache/Mimic2"
  },
  "espeak": {
    "lang": "english-us",
    "voice": "m1"
  },
  "mozilla": {
    "url": "https://tts.example.com/"
  },
  "mimic3_tts_plug": {
    "voice": "en_US/cmu-arctic_low",
    "speaker": "slt",
    "length_scale": 0.8,
    "noise_scale": 0.667,
    "noise_w": 0.8
  }
}

I was using my own TTS server a bit, that’s why there’s a mozilla section.

Fixed!

I think this fixed it:

mycroft-pip uninstall onnxruntime-gpu
mycroft-pip install --force-reinstall onnxruntime

Somewhere along the way I had tried to get CUDA acceleration working because I have an nvidia gpu, but I guess that didn’t work. CPU seems to be plenty fast for this but I’m curious if anyone finds it much better with gpu support.

I did a few other things that maybe helped or maybe had no effect:

# this was to fix an error in audio.log
sudo apt install mplayer
mycroft-pip install git+https://github.com/JarbasAl/py_mplayer

# that broke dateparser, causing a new error in Mycroft's audio.log
mycroft-pip install --upgrade regex

# this fixed dateparser:
mycroft-pip install dateparser

Here’s the dateparser error:

2022-08-15 08:02:33.146 | ERROR    | 72661 | mycroft.tts.tts:create:618 | The selected TTS backend couldn't be loaded. Falling back to Mimic
Traceback (most recent call last):
  File "/home/user/Downloads/mycroft/mycroft-core/mycroft/tts/tts.py", line 608, in create
    clazz = load_tts_plugin(tts_module)
  File "/home/user/Downloads/mycroft/mycroft-core/mycroft/tts/tts.py", line 545, in load_tts_plugin
    return load_plugin('mycroft.plugin.tts', module_name)
  File "/home/user/Downloads/mycroft/mycroft-core/mycroft/util/plugins.py", line 48, in load_plugin
    plugins = find_plugins(plug_type)
  File "/home/user/Downloads/mycroft/mycroft-core/mycroft/util/plugins.py", line 31, in find_plugins
    return {
  File "/home/user/Downloads/mycroft/mycroft-core/mycroft/util/plugins.py", line 32, in <dictcomp>
    entry_point.name: entry_point.load()
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2470, in load
    self.require(*args, **kwargs)
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2493, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 800, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (regex 2022.7.25 (/home/user/Downloads/mycroft/mycroft-core/.venv/lib/python3.8/site-packages), Requirement.parse('regex!=2019.02.19,!=2021.8.27,<2022.3.15'), {'dateparser'})