Trying to install both Mycroft-Core and MagicMirror on the same PI

Yes it is a Raspberry Pi 3b. on a 16gb sd card.

I’m at work now and don’t have access to the Pi.

But what you’re saying makes a lot of sense. I will go back to my original MagicMirror image and start over and do a git clone from the master branch.

I would like to eventually create a skill for Mycroft to interact with the MagicMirror. Which installation would make more sense to you? Install as a service, or running Mycroft in Virtualenv? It seems to me it would make more sense to run in a virtualenv, but the most important thing will be getting both applications running at the same time and able to easily restart on their own after a reboot. For example, if we lose power.

Whatever advice you can give would be much appreciated. Thanks!

It might be better to run in a virtualenv to keep the dependencies in check. The aptpackage gets cranky if the dependencies versions are changed (as they may do) if pip is used to install stuff on the system.

Top about the dev-setup, avoid the --allow-root flag. It’s meant to run in user mode with sudo. Running as root will install the virtualenv in the root users home folder instead of the user that should be running it (Pi or a separate user).

I must have misunderstood, I thought running as sudo causes problems. Not the other way around.

     echo "This script should not be run as root or with sudo."
  echo "To force, rerun with --allow-root"

I have had issues not running as --allow-root

I thought running as sudo was a no-no. for dev_setup.sh

I am new at this so please be patient with my comprehension.

I read this post and understood that I should not run as sudo.

Did I misunderstand? If so, thanks for pointing me in the right direction.

Sorry I misspoke, you shouldn’t run it as sudo, the script will invoke sudo when necessary.

You should just start it with the normal user with ./dev-setup.sh this will run some parts with sudo and ask for password.

–allow-root is a way to get around the restriction installing the development environment as a normal user in the few cases when it’s actually desirable to install it as root (ex, docker installation), but shouldn’t be used normally.

Thanks for the advice, I was misunderstanding what I read. I have gone back to my MagicMirror image and installed mycroft-core via

  • git clone --depth=1 https://github.com/MycroftAI/mycroft-core.git.

Then

  • cd ~/Mycroft-core

  • bash dev_setup.sh.

The installation went ok, with no issues. But when I started

  • ./start-mycroft.sh debug

it gave an error about Padatious. and stopped.

It is apparently an issue with the libfann-dev needing to be newer than what’s in the repo.

I am considering trying two simultaneous builds on different sd cards. One which uses virtualenv and the other installing mycroft as a service through

  • sudo apt-get install mycroft-core

To see which method presents fewer issues. My concern with the latter is it installs a Mycroft user, and I’m wondering if that will present permission issues that will be harder to overcome.

I tried starting with the picroft image that’s available, but installing MagicMirror on to Jessie Lite proved just as difficult it seems. To install both on the same system requires a 16gb sd card. Fortunately I have 2 to play with.

Thank you so much for your advice. I am very new to all of this. If there is anything else I should look out for with either method, please let me know what you think.

You should be able to add the mycroft apt repo and install the newer padatious library or pull the dpkg from the official stretch arm repo.

Thanks! I’ll let you know how that works.

Well… Thanks to your advice, the Mycroft-core is up and running in virtualenv with a working MagicMirror application on the same pi.

It worked following your last suggestion, following these steps listed in these instructions: (not sure all steps were necessary but followed them anyhow)

  • sudo apt-get install apt-transport-https

Download and install signing key from keyserver.

  • sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F3B1AA8B

Create apt source entry (stable releases).

  • sudo bash -c 'echo "deb http://repo.mycroft.ai/repos/apt/debian debian main" > /etc/apt/sources.list.d/repo.mycroft.ai.list'

Update the apt cache to include the new repository

  • sudo apt-get update

  • sudo apt-get install libfann2

From there, everything worked like a charm. Now I just need to figure out how to start everything MagicMirror and Mycroft when the desktop boots and I can start working on the MagicMirror skill for mycroft. Do you recommend using .bashrc to start the virtualenv? Or would there be a better suggestion? Considering that it’s necessary to set the desktop to auto login as pi user for the MagicMirror to start?

2 Likes

In linux there are a lot of ways to achieve that, I’m not sure which way is “cleanest” check out this stackoverflow thread for some suggestion from more experienced people: https://unix.stackexchange.com/questions/122424/execute-a-command-on-user-logon

1 Like

Once again thank you for your guidance.

Turns out that because the desktop automatically logs in as pi user to run MagicMirror the best way I found to start mycroft-core was to call a

  • start.sh

Script in the

  • /home/pi/.config/lxsession/LXDE-pi/autostart

Here’s the script I added:

`#!/bin/bash
 #start.sh for starting mycroft-core

  Echo Waiting for MagicMirror to complete startup...

   Sleep 25

    Echo Starting Mycroft-core virtualenv...
   
   Sleep 5

    Cd /home/pi/mycroft-core/

    start-pulseaudio-x11

     ./start-mycroft.sh all

     Sleep 5

     ./start-mycroft.sh cli`

Not sure why I needed to add the start-pulseaudio-x11, but I couldn’t get it to work just by adding autospawn=yes to the pulseaudio config file.

I used nano (not sudo) to edit the autostart

  • nano /home/pi/.config/lxsession/LXDE-pi/autostart

To read:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@lxterminal -e "/home/pi/start.sh"

I also made the start.sh script executable by:

  • chmod +x /home/pi/start.sh

Anyway, thanks again for your help!

Now to start working on the mycroft MagicMirror skill to allow mycroft to control some basic functions of the MagicMirror modules.

Cheers!

3 Likes

Great writeup, @dmwilsonkc

@dmwilsonkc, thanks a lot for the write-up. Any update on the skills for MyCroft? Would love to use Mycroft for my smartmirror.

@svarto The skill is completely functional. I recommend reading this post: Creating my first skill with essentially no experience - Mycroft MagicMirror skill

That should give you a good understanding of how the skill works and how to install the skill and the required modules for MagicMirror.

I am hanging Christmas lights at the moment, but would be glad to answer any questions later.

Cheers!

@svarto There’s another post you should look at. I almost forgot. Testing and Feedback for Magic-Mirror-Voice-Control-Skill

Hopefully that will give you everything you need.

Cheers again!

Please help im !REALLY! new to all this iv followed your step’s (right i think) but when i go to start picroft i get the error

bash: ./dev-setup.sh: No such file or directory

please tell me what im doing wrong

Not sure why that is. Did you follow instructions here in post 17?

Yes mate followed every step am I running the set up up scripts right, I’m newbie to all this.

I think you have to cd into the directory where shat script is. I think this could do it

cd /home/pi/mycroft-core

andt then run

./dev_setup.sh

ok so im starting to see i need help installing the mycroft-core is anyone out there willing to help me please, as im at a loss iv reinstalled stretch as i think iv gone about this all wrong, iv got magicmirror installed.

thanks