MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Can't get MMM-Facial-Recognition working

  • Hi All,

    I’m running Magic Mirror on a Pi 3B+, and I’m using the Pi V2 camera module.
    I’ve installed the module MMM-Facial-Recognition and the required training tools. After training the model, and verified it positively identifies me using the supplied test tooling, I’ve configured and enabled the module within Magic Mirror.
    The module seems active, as only default classes appear on the mirror, however, if I’m in front of the camera, nothing changes.
    I’ve basically used the config as supplied followed the instructions.
    Anyone a clue on where I can check what’s going wrong here?

    Kind regards,


  • turn on the developers window with ctrl-shift-i
    then select the console tab, and look for messages as you move about

    also, how are you starting MM? with pm2? or your own command (npm start)

    the pm2.log file might show something

  • Ok, thanks for the info. I’ve found that the magicmodule is supspended as a result of it crashing. Error in the log:
    0|MagicMir | TypeError: PythonShell is not a constructor
    0|MagicMir | at Class.python_start (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:11:21)
    0|MagicMir | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:40:14)
    0|MagicMir | at Socket. (/home/pi/MagicMirror/modules/node_modules/node_helper/index.js:113:11)
    0|MagicMir | at Socket.emit (events.js:182:13)
    0|MagicMir | at /home/pi/MagicMirror/node_modules/
    0|MagicMir | at process._tickCallback (internal/process/next_tick.js:61:11)

    I’ve seen other reports of this issue, at least now I’ve got a lead where to look.

    Kind regards,

  • did you run npm install in the MMM-Facial-Recognition folder?

  • @jorgh6 said in Can’t get MMM-Facial-Recognition working:

    TypeError: PythonShell is not a constructor

    This issue is discussed at . So I’ll pick it up from there. Apparently some api changes on recent PythonShell updates, there are more modules suffering from the same issue.

  • Got it working by changing two lines in node_helper.js (changes in bold).

    Line 4:
    const {PythonShell} = require(‘python-shell’);
    Line 11:
    const pyshell = new PythonShell(‘modules/’ + + ‘/facerecognition/’, { pythonPath: ‘python’, mode: ‘json’, args: [JSON.stringify(this.config)]});

Log in to reply