MycroftAI / mycroft-core

Mycroft Core, the Mycroft Artificial Intelligence platform.
https://mycroft.ai
Apache License 2.0
6.48k stars 1.27k forks source link

GNU Guix Port #3074

Open phodina opened 2 years ago

phodina commented 2 years ago

Is your feature request related to a problem? Please describe. Hi, I like Mycroft project and I'm porting the package to GNU Guix. This is probably a reverse feature as the aim is just to clarify some issues I encountered in porting.

Describe the solution you'd like I'd like to have the package integrated in the system to have seamless install and simple configuration of the service.

Describe alternatives you've considered This will make Mycroft portable between any existing Linux distro.

Additional context I've created a package description and ran into some issues I'd need to clarify.

Here's a link to the thread about the patch for GNU Guix.

  1. When running the mycroft-audio I get some missing modules (pychromecast, py_mplayer, vlc). Are they needed?

    $ /gnu/store/z9gas3a9rxi64ynz74davmn7m9w67jxl-mycroft-core-21.2.2/bin/mycroft-messagebus & 2>&1 /dev/null
    $ /gnu/store/z9gas3a9rxi64ynz74davmn7m9w67jxl-mycroft-core-21.2.2/bin/mycroft-audio
    2022-02-15 13:51:54.582 | INFO     | 11174 | mycroft.audio.__main__:main:46 | Starting Audio Service
    2022-02-15 13:51:54.587 | INFO     | 11174 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
    2022-02-15 13:51:54.589 | INFO     | 11174 | mycroft_bus_client.client.client | Connected
    2022-02-15 13:51:54.589 | INFO     | 11174 | mycroft.util.process_utils:start_message_bus_client:155 | Connected to messagebus
    2022-02-15 13:51:54.591 | WARNING  | 11174 | mycroft.tts.tts:clear_cache:428 | This method is deprecated, use TextToSpeechCache.clear
    Carnegie Mellon University, Copyright (c) 1999-2011, all rights reserved
    mimic developers, Copyright (c) 2016-2020, all rights reserved
    version: mimic-1.3.0.1
    2022-02-15 13:51:55.107 | INFO     | 11174 | mycroft.audio.audioservice:get_services:63 | Loading services from /gnu/store/z9gas3a9rxi64ynz74davmn7m9w67jxl-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/audio/services/
    2022-02-15 13:51:55.107 | INFO     | 11174 | mycroft.audio.audioservice:load_internal_services:135 | Loading chromecast
    2022-02-15 13:51:55.109 | ERROR    | 11174 | mycroft.audio.audioservice:load_internal_services:143 | Failed to import module chromecast
    ModuleNotFoundError("No module named 'pychromecast'")
    2022-02-15 13:51:55.109 | INFO     | 11174 | mycroft.audio.audioservice:load_internal_services:135 | Loading mopidy
    2022-02-15 13:51:55.111 | INFO     | 11174 | mycroft.audio.audioservice:load_internal_services:135 | Loading mplayer
    2022-02-15 13:51:55.117 | ERROR    | 11174 | audioservice_mplayer:<module>:20 | install py_mplayer with pip install git+https://github.com/JarbasAl/py_mplayer
    2022-02-15 13:51:55.118 | ERROR    | 11174 | mycroft.audio.audioservice:load_internal_services:143 | Failed to import module mplayer
    ModuleNotFoundError("No module named 'py_mplayer'")
    2022-02-15 13:51:55.118 | INFO     | 11174 | mycroft.audio.audioservice:load_internal_services:135 | Loading simple
    2022-02-15 13:51:55.118 | INFO     | 11174 | mycroft.audio.audioservice:load_internal_services:135 | Loading vlc
    2022-02-15 13:51:55.120 | ERROR    | 11174 | mycroft.audio.audioservice:load_internal_services:143 | Failed to import module vlc
    ModuleNotFoundError("No module named 'vlc'")
    2022-02-15 13:51:55.124 | INFO     | 11174 | mycroft.audio.audioservice:load_services:235 | Finding default backend...
    2022-02-15 13:51:55.124 | INFO     | 11174 | mycroft.audio.audioservice:load_services:239 | Found local
    2022-02-15 13:51:55.227 | INFO     | 11174 | mycroft.audio.__main__:on_ready:33 | Audio service is ready.
  2. Directory for skills. Currently it's under /opt/mycroft. I've changed it to be /gnu/store/<HASH>-mycroft-core-<VERSION>/opt/mycroft but it gives me an error that the location is read-only which the store by design is. So would it be better to store it under var?

    $ /gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/bin/mycroft-skills
    2022-02-15 14:27:07.954 | INFO     | 13682 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
    2022-02-15 14:27:07.955 | INFO     | 13682 | mycroft_bus_client.client.client | Connected
    2022-02-15 14:27:07.956 | INFO     | 13682 | mycroft.util.process_utils:start_message_bus_client:155 | Connected to messagebus
    2022-02-15 14:27:07.958 | INFO     | 13682 | mycroft.skills.msm_wrapper:create_msm:96 | Acquiring lock to instantiate MSM
    Traceback (most recent call last):
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/bin/.mycroft-skills-real", line 33, in <module>
    sys.exit(load_entry_point('mycroft-core==21.2.2', 'console_scripts', 'mycroft-skills')())
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/skills/__main__.py", line 217, in main
    skill_manager = _initialize_skill_manager(bus, watchdog)
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/skills/__main__.py", line 263, in _initialize_skill_manager
    skill_manager = SkillManager(bus, watchdog)
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/skills/skill_manager.py", line 143, in __init__
    self.skill_updater = SkillUpdater()
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/skills/skill_updater.py", line 58, in __init__
    self.dot_msm_path = os.path.join(self.msm.skills_dir, '.msm')
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/skills/skill_updater.py", line 111, in msm
    self._msm = create_msm(msm_config)
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/skills/msm_wrapper.py", line 99, in create_msm
    makedirs(msm_config.skills_dir)
    File "/gnu/store/mhbnni58w5hvpr304jxc5kws1vrp2l1i-python-3.9.9/lib/python3.9/os.py", line 225, in makedirs
    mkdir(name, mode)
    OSError: [Errno 30] Read-only file system: '/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/opt/mycroft/skills'
  3. Mycroft-speech-client reports errors with ALSA lib

    $ /gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/bin/mycroft-speech-client
    2022-02-15 14:44:53.168 | INFO     | 14523 | mycroft.messagebus.load_config:load_message_bus_config:33 | Loading message bus configs
    2022-02-15 14:44:53.169 | INFO     | 14523 | mycroft_bus_client.client.client | Connected
    2022-02-15 14:44:53.170 | INFO     | 14523 | mycroft.util.process_utils:start_message_bus_client:155 | Connected to messagebus
    ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
    ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
    ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
    ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
    ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
    ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
    2022-02-15 14:44:53.187 | INFO     | 14523 | mycroft.client.speech.listener:create_wake_word_recognizer:328 | Creating wake word engine
    2022-02-15 14:44:53.187 | INFO     | 14523 | mycroft.client.speech.listener:create_wake_word_recognizer:351 | Using hotword entry for hey mycroft
    2022-02-15 14:44:53.188 | INFO     | 14523 | mycroft.client.speech.hotword_factory:load_module:500 | Loading "hey mycroft" wake word via precise
    2022-02-15 14:44:54.708 | INFO     | 14523 | mycroft.client.speech.hotword_factory:<lambda>:306 | Updated precise model
    2022-02-15 14:44:55.024 | ERROR    | 14523 | mycroft.client.speech.hotword_factory:initialize:528 | Could not create hotword. Falling back to default.
    Traceback (most recent call last):
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/client/speech/hotword_factory.py", line 513, in initialize
    instance = clazz(hotword, config, lang=lang)
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/client/speech/hotword_factory.py", line 258, in __init__
    self.runner.start()
    File "/gnu/store/f76mlyjsfrjy92w0s1gmnc3zp4ajnv7k-python-precise-runner-0.3.1/lib/python3.9/site-packages/precise_runner/runner.py", line 199, in start
    self.engine.start()
    File "/gnu/store/f76mlyjsfrjy92w0s1gmnc3zp4ajnv7k-python-precise-runner-0.3.1/lib/python3.9/site-packages/precise_runner/runner.py", line 55, in start
    self.proc = Popen(self.exe_args, stdin=PIPE, stdout=PIPE)
    File "/gnu/store/mhbnni58w5hvpr304jxc5kws1vrp2l1i-python-3.9.9/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    File "/gnu/store/mhbnni58w5hvpr304jxc5kws1vrp2l1i-python-3.9.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/home/pethod/.local/share/mycroft/precise/precise-engine/precise-engine'
    2022-02-15 14:44:55.044 | INFO     | 14523 | mycroft.client.speech.hotword_factory:load_module:500 | Loading "hey mycroft" wake word via pocketsphinx
    2022-02-15 14:44:55.048 | ERROR    | 14523 | mycroft.client.speech.hotword_factory:initialize:528 | Could not create hotword. Falling back to default.
    Traceback (most recent call last):
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/client/speech/hotword_factory.py", line 513, in initialize
    instance = clazz(hotword, config, lang=lang)
    File "/gnu/store/80p92q9ccbw0bycz3d47rmr6hv6asplw-mycroft-core-21.2.2/lib/python3.9/site-packages/mycroft/client/speech/hotword_factory.py", line 134, in __init__
    from pocketsphinx import Decoder
    ImportError: cannot import name 'Decoder' from 'pocketsphinx' (/gnu/store/q165sa5z245rf8khv23h9z7n8r82xchv-pocketsphinx-5prealpha/lib/python3.9/site-packages/pocketsphinx/__init__.py)
    2022-02-15 14:44:55.149 | ERROR    | 14523 | mycroft.client.speech.__main__:on_error:187 | Audio service failed to launch (ImportError("cannot import name 'Decoder' from 'pocketsphinx' (/gnu/store/q165sa5z245rf8khv23h9z7n8r82xchv-pocketsphinx-5prealpha/lib/python3.9/site-packages/pocketsphinx/__init__.py)")).

There is this thread about this issue though I don't know how to apply the suggested change.

forslund commented 2 years ago
  1. None of these are necessary, they can be used for some benefits but the base service can run without any of these.

  2. I think it would be best if the mycroft data/skill directory was somewhere under the user folder or better yet under an XDG user folder (See PR #2803). The big problem may be that Mycroft allows skill installs using voice "Hey mycroft install spotify skill" which may install python packages using pip.

  3. Those Alsa debug prints are probably not a problem I've got them on my system as well and things work.