Message Boards Message Boards


Remote Kernel on Raspberry Pi

Posted 10 years ago
27 Replies
11 Total Likes
I am trying to connect to a remote Pi using the RDK. I guess there has to be a way to get the Mathematica kernel running on the Pi - without invoking the GUI frontend (i am running headless over SSH). But I am unable to figure out how to do that - has anybody already got that going? Any help is appreciated.

27 Replies
Posted 7 years ago

I am not a rdp expert but I had similar problems trying to run rdp with smalltalk on a linux amazon box to a macintosh. I found VNC worked well. You may want to try vnc to your pi. But this is just a guess .

POSTED BY: Scott Sproule
Posted 7 years ago

I have a related question and wonder whether any of you could help me.

Using a Linux machine, I logged with a remote desktop service (rdp protocol) onto a Raspberry Pi 2. Everytime I try to start Mathematica with the User Interface the connection crashes. Has anybody experience on how to get that to work, or is that not supported?

The terminal option using Wolfram works well.

Posted 8 years ago

I have this working reasonably well.

IN the remote kernel status setup a remote kernel with the following custom launch command. The hostname should be the hostname of he working ssh command outlined in the second comment below. Generally i set the number of kernels on rasp pi 2 to be 3.

ssh -x -f -l pi 1 wolfram -mathlink -linkmode Connect 4 -linkname \ '2' -subkernel -noinit

The numbers in the command above all have ` quotes around them and the 2 also has ' quotes around it.

It is important/necessary that you are able to remote ssh without a password for this to work. eg: ssh pi@mathterm.local where math term. local is avalid hostanme or ip addres. (to enable this look on the web for how to add rsa keys to the .ssh files).

LaunchKernels[] in a notebook should now launch local kernels + remote kernels.

POSTED BY: Scott Sproule
Posted 8 years ago

This worked for me:

(Using Mac OS X Yosemite)

SSHing into the Raspberry Pi threw an RSA key error.

So I went to the Mac Terminal and Typed: open /Users/yourusernamehere/.ssh. I navigated to the "knownhosts" file and I found the key associated with my Pi's IP address and deleted it.

I tried to login into the Pi again and it asked my to verify the key.

After I logged into the Pi I went to Wolfram(local machine not pi) and changed my notebook type to from (Local) to (Raspberry Pi). I then typed $MachineName and the Output was "raspberrypi".

For me at least I am guessing that the RSA key was the issue.

I just thought I would post this in case anyone else had the same Problem.

POSTED BY: Thomas Melehan

Taking yet another run at this a year or so later.

Raspberry Pi 2 Fresh NOOBS 1.4.0 (2015-02-18) SD card Macbook Pro (Retina late 2012) OSX 10.10.2 Mathematica Network ethernet cable

Purpose - Run Mma on the RPi kernel from a front end running on the Mac

This was a new RPi, and the network had been reshuffled, so the first problem was getting a functional ssh from Mac Terminal to RPi. Resolution (after a day and a half of googling) was to find the .ssh/knownhosts from the Mac file system. I tried several edits suggested in the forums but could make none work. Removal of the knownhosts file was the only thing that fixed it. That file was a half-encrypted text file that included recognizable host ip addresses from past configurations, but why the simple persistence of old data causes fatal termination with such alarming security warnings, I have no idea.

Now, I evidently have a resysthesized known_hosts file, a functioning ssh from the Mac Terminal, and a functioning wolfram program on the PRi.

Next I tried hooking the Mac to the RPi using the Mac's Mma RDK. First, I verified that I only had the single (Local) kernel installed in Evaluation>Kernel Configuration Options, then I clicked on the Configure Pi Connection on the Remote Development Control Panel, filling in the RPi's ip address (from running ifconfig on the RPi after I first set it up). I used the palette to open a Pi Test & Example Notebook. Executing $MachineName got me nothing. Options[$FrontEnd,EvaluatorNames] gets me nothing. As a matter of fact, 2+2 gets me nothing. Evaluation>Notebook's Kernel shows Raspberry Pi checked.

I clicked on the Raspberry Pi in the Evaluation>Kernel Configuration Options panel and found an entry in the Basic Options > Remote Host: e$738, and that looked suspiciously like a Module variable that somehow didn't get resolved, so I edited it to the RPi's ip address, opened a fresh Pi test notebook. $MachineName gets me a Message "The child process 2095 reports:" and "The kernel Raspberry Pi failed to connect to the front end. (Error = MLECONNECT). You should try running the kernel connection outside the front end."

I need a hint.

POSTED BY: Fred Klingener

Here is what worked.

In the Pi Test notebook, I set the Evaluation>Notebook's Kernel to Local, then



Options[$FrontEnd, EvaluatorNames]

{EvaluatorNames -> {"Local" -> {"AutoStartOnLaunch" -> True}, 
   "Raspberry Pi" -> {"RemoteMachine" -> True, 
     "TranslateReturns" -> True, "AutoStartOnLaunch" -> False, 
     "Executable" -> "/usr/bin/wolfram", 
     "HostName" -> 
     "RemoteLogin" -> "pi"}}}

 , EvaluatorNames ->
   "Local" -> {"AutoStartOnLaunch" -> True}
   , "Raspberry Pi" ->
     "RemoteMachine" -> True
     , "TranslateReturns" -> True
     , "AutoStartOnLaunch" -> False
     , "Executable" -> "/usr/bin/wolfram"
     , "HostName" -> "", "RemoteLogin" -> "pi"

Then set the Evaluation>Notebook's Kernel to Raspberry Pi and execute


It seems clear (to me anyway) that this is a buggy Remote Development Kit failing to resolve the variable reference in RemoteDevelopmentKit`Private`

POSTED BY: Fred Klingener

OK, now I have a Raspberry Pi 2. Still no luck with the RDK. I can't even get the RDK to successfully install... the CDF installer reports that it succeeds, but the RDK palette never appears in the Palettes menu.

I am running Raspbian, installed from the NOOBS image:

pi@raspberrypi ~ $ uname -r 3.18.7-v7+

pi@raspberrypi ~ $ wolfram Wolfram Language (Raspberry Pi Pilot Release) Copyright 1988-2015 Wolfram Research Information & help:

In[1]:= $Version

Out[1]= 10.0 for Linux ARM (32-bit) (February 3, 2015)

POSTED BY: David DeBrota
I tried again to get a connection to a remote kernel, without success.  This time I tried running M on an ubuntu 14.04 AMD x86-based desktop machine (named "octopus"), connecting over a LAN to a RaspberryPi running Raspbian.  Here's what works:

octopus can ping RPi
RPi can ping octopus
from octopus, I can use SSH to start a console session running on the RPi... the RPi user is pi@raspberrypi
from octopus, I can also use SSH to browse files/directories on the RPi
M front end and kernel run just fine on RPi
(text only) Wolfram Language works on RPi, both when I invoke it locally and remotely (via SSH console session)
M front end and kernel run just fine on octopus
the RDK has been installed into M on octopus... the palette comes up as it should

Now, I try to connect the M front end running on octopus to a kernel running on RPi.  No luck.

So I have now tried connecting to this same RPi from a Windows-based laptop and an ubuntu-based desktop, with no success either way.

I welcome any suggestions!
POSTED BY: David DeBrota
The remote kernal setup is very particular. If you don't get it just right the local kernal reports the following error:  SSH could not find the machine on which to launch the kernel 'Raspberry Pi'.

Under Basic Option:
Machine Name: raspberrypi
Remote Login: pi
Kernel Program: /usr/bin/wolfram

raspberrypi is the name of the machine and I added an entry in my windows host file with the ip address. For the Remote Login: I included the password as pi@raspberry and this caused the error message so it should be just pi. The RDK will ask you to confirm the connection and ask for a password.
POSTED BY: Jay Morreale
I guess the method described in the last message (using the computer name to specify location of the Remote Host on the network) only works on even days or for some other inscrutable reason. The connection failed this morning, so I'm back to the numerical IP address and will stay there.

Fred Klingener
POSTED BY: Fred Klingener
The RDK will evidently find a named Raspberry Pi on the network and configure it. This should make things much easier if the network gets shuffled and addresses are reassigned.

The following setup evidently works fine from Mathematica menu bar on the MacBook, selecting the new kernel under Evaluation>Kernel Configuration Options>Edit...

Another issue occasionally discussed on this forum is whether or not the wolfram program must be run from sudo. So far, I haven't been able to detect a difference in notebook behavior. I don't have the background to even know what questions to ask, so I hope someone can explain it.

Fred Klingener
POSTED BY: Fred Klingener
I gave up on the RDK about three weeks ago, took another run at it with the arrival of my RPi camera, and I have some progress to report.

My last post in this thread outlined the failure to establish a notebook on Mma running on a Macbook but with the kernel running on the networked RPi. The symptom was a simple refusal to accept a login, (and that led to what I thought were particularly nasty loops that were hard to escape from.)

The crux problem, I've decided is the behavior of the Remote Development Control Panel (the dropdown palette). If I fail to replace the "Login on Pi" and expect the apparent default "pi" to be selected, subsequent attempts to use the kernel in a notebook fail.

The plausible reason can be seen by looking at Kernel>Evaluation>Kernel Configuration Options..., selecting the Raspberry Pi kernel I just created and choose to Edit it. At this stage,  that kernel configuration looks like

(The Remote host is the IP address I got from running ifconfig from the terminal on the Raspberry Pi) The entry under "Remote user:" looks suspiciously like a Module variable name, and if used at login would seemingly guarantee failure.

If I edit that entry explicitly to "pi", I can successfully log in.



Fred Klingener
POSTED BY: Fred Klingener
Posted 10 years ago
Using the RDK fails for me, too.

After a delay of a minute or two, I get the following error after executing the $MachineName in the Pi test notebook.
The kernel Raspberry Pi failed to connect to the front end. (Error = MLECONNECT). You should try running the kernel connection outside the front end.

Here's some more info:
In[7]:= Options[$FrontEnd, EvaluatorNames]

Out[7]= {EvaluatorNames -> {"Local" -> {"AutoStartOnLaunch" -> True},
   "Raspberry Pi" -> {"RemoteMachine" -> True,
     "TranslateReturns" -> True, "AutoStartOnLaunch" -> False,
     "Executable" -> "/usr/bin/wolfram", "HostName" -> "",
      "RemoteLogin" -> "pi"}}}

While I'm waiting on the remote kernel, I see the following when running "ps aux | grep Wolfram" in a remote ssh terminal to the RPi:
ps aux | grep Wolfram
pi       20401  0.9  4.5 115736 20404 ?        Ssl  11:53   0:00 /opt/Wolfram/WolframEngine/10.0/SystemFiles/Kernel/Binaries/Linux-ARM/WolframKernel -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName 63865@,63866@ -LinkHost

Does something need to be configured on host RPi Wolfram kernel? Looking at the output of the ps aux | grep Wolfram command, the LAN IP address of doesn't correspond to any machine on my LAN. The IP of the client (FrontEnd using the RDK) is I should also add that I can ssh into the host RPi without any issues.
I'm recreating most of this almost a month later, and I can't reconcile the results I'm getting with the advice posted here.

To summarize:

1.) I have what I think is a functional installation on RPi. From the RPi command line, I can run ~$ wolfram and a Front Ended Mathematica from the RPi GUI ( ~$ startx).
2.) from a command line on the RPi, ~$ ifconfig reports an IP Address for the RPi of
3.) From a terminal window on a Mac on the network with the RPi
ssh -l pi
, I can log on and run wolfram.

Confusion came when I downloaded Remote Development Kit and installed it on my Mac (running Mma 9.0.1, but other releases don't behave differently). Starting with the RPi booted to login, if I bring down the Remote Development Control Panel palette and click 'Configure Pi Connection,' I get a dialog that requests 'Network machine of Pi:' I'm guessing that this is the IP address of the RPi - the same one I used in the ssh above. The 'Login on Pi:" I suppose is my user name on the Pi, which has been left the default. When I click 'OK,' nothing obvious happens. I'll get to the things that evidently really happen later, but next I clicked on the 'Pi Test & Example Notebook' on the RDK Control Panel. The nb opens, and I run the $MachineName line. This opens a dialog box named 'Password For RemoteDevelopmentKitdial...' I don't have a clue what's expected here, but I've tried using the RPi's login password. The Mma line evidently executes, but there's no output.

About here, I looked at quitting the Mac kernel and starting over. What's hard to figure is that the Evaluation->Kernel->Quit Kernel yields a list with 'Local' and by now ten or so (grayed out) 'Raspberry Pi's (by now I had attempted the RDK setup process a couple of times.) The same list appears in the 'Notebook's Kernel,' here all black and all the RPi kernels checked. The list appearing under 'Default Kernel' is all black with 'Local' checked. 

So now I've unplugged the power to the RPi, closed Mma, reopened Mma and checked the kernel list. All there. Executing [font='courier new', courier, monospace]Options[$FrontEnd, EvaluatorNames] on a fresh copy of Mma on the laptop lists them all with forms like
"Raspberry Pi" -> {"RemoteMachine" -> True
,"TranslateReturns" -> True
,"AutoStartOnLaunch" -> False
,"Executable" -> "/usr/bin/wolfram"
,"HostName" -> ""
, "RemoteLogin" -> RemoteDevelopmentKit`Private`dialogUserName$1324

I ran
, the RDK disappeared from the Palette menu, but all the Kernels remain.

So I'm left without a clue how I got here, how to get rid of the spare kernels and how to connect remotely to Mathematica running on the Raspberry Pi.

TIA for any advice on any of this.

Fred Klingener
POSTED BY: Fred Klingener
Hi David,

Have you tried ps wuax | grep WolframKernel on your RPi right after you run your remote Pi Notebook? What does it say? Idon't think you should change the "AutoStartOnLaunch" to True.
POSTED BY: Silvia Hao
Here's the output requested... in between the two calls to ps wuax I tried to start a "New Pi Notebook" on my laptop:
pi@raspberrypi ~ $ ps wuax | grep WolframKernel
pi 2670 1.8 8.4 168812 37996 ? Sl Dec05 298:46 /opt/Wolfram/Wo
lframEngine/10.0/SystemFiles/Kernel/Binaries/Linux-ARM/WolframKernel -noinit -pw file /opt/Wolfram/WolframEngine/10.0/Configuration/Licensing/playerpass -mathlin
k -linkprotocol SharedMemory -linkconnect -linkname 4zfe4_shm pi 2835 1.9 9.8 173152 44168 ? Sl Dec05 302:01 /opt/Wolfram/Wo
lframEngine/10.0/SystemFiles/Kernel/Binaries/Linux-ARM/WolframKernel -mathlink -linkprotocol SharedMemory -linkconnect -linkname 5dgpy_shm
pi 9224 0.0 0.1 3544 880 pts/1 S+ 01:01 0:00 grep --color=au
to WolframKernel pi@raspberrypi ~ $ ps wuax | grep WolframKernel
pi 2670 1.8 8.4 168812 37996 ? Sl Dec05 298:47 /opt/Wolfram/WolframEngine/10.0/SystemFiles/Kernel/Binaries/Linux-ARM/WolframKernel -noinit -pwfile /opt/Wolfram/WolframEngine/10.0/Configuration/Licensing/playerpass -mathlink -linkprotocol SharedMemory -linkconnect -linkname 4zfe4_shm
pi 2835 1.9 9.8 173152 44168 ? Sl Dec05 302:02 /opt/Wolfram/WolframEngine/10.0/SystemFiles/Kernel/Binaries/Linux-ARM/WolframKernel -mathlink -linkprotocol SharedMemory -linkconnect -linkname 5dgpy_shm
pi 9226 0.0 0.1 3544 880 pts/1 S+ 01:02 0:00 grep --color=auto WolframKernel
POSTED BY: David DeBrota
Hi David,

I'm not sure what goes wrong, but I think your wolfram arguments are quite different from mine:
pi   2260  9.7  9.4 187804 42288 ?  Ssl  14:01   1:06
-mathlink -LinkMode Connect -LinkProtocol TCPIP
-LinkName 58054@,58055@ -LinkHost

I think for a remote connection, shouldn't the -LinkProtocol be TCPIP, and there are IP addresses in -LinkName and -LinkHost?

I'm not a regular Linux user and never tried remotely using Mathematica before. I think we may have to wait for someone from WRI to check this.
POSTED BY: Silvia Hao
I'm not able to get the remote connection to work either.  I am running Mathematica on a Windows 7 laptop, and have Mathematica also working on my Raspberry Pi (on Raspbian).  I can ssh to the RPi from my laptop and run the "wolfram" command without problems.  When I am directly using the RPi, I can invoke the Mathematica front end and get commands like Plot[ ] to work just as they do on my laptop.

I have installed the Remote Development Control Panel on my laptop's Mathematica, and configured the connection to my RPi over the LAN.

When on my laptop I run:
Options[$FrontEnd, EvaluatorNames]

I get this output:
{EvaluatorNames -> {"Local" -> {"AutoStartOnLaunch" -> True},
   "Raspberry Pi" -> {"RemoteMachine" -> True,
     "TranslateReturns" -> True, "AutoStartOnLaunch" -> False,
     "Executable" -> "/usr/bin/wolfram",
     "HostName" -> "", "RemoteLogin" -> "pi"}}}

But when I try to create a "New Pi Notebook", I get this error:
Mathematica could not establish a connection to the kernel.
Kernel: Raspberry Pi.
Low-level MathLink error: Unknown internal error.

Should I change "AutoStartOnLaunch" to True?
POSTED BY: David DeBrota
And in-explicably - it started working :-) Thanks for all the help.


And I assume that you can normally ssh to this machine ( from your desktop using login 'pi' ?

Also note that the Wolfram Language on the RPi comes with a 4 license password, meaning that if you try to start a fifth 'wolfram' instance it will fail. You can check your process listing to make sure you don't have extra copies running (ps wuax | grep WolframKernel)
POSTED BY: Arnoud Buzing

Thanks for your really useful linux command. By using it checking the processes, it turned out when I was installing the RDK on my laptop, it was connected to a VPN network. I guess somehow this affected the installation, (maybe the IP address was hard coded in some configure file during installation?) so when I tried to use RPi remotely, Mathematica sent a start-remote-kernel shell command to RPi with the host IP 10.x.x.x rather than 192.168.x.x. I re-installed the RDK without VPN environment,
and everything is great now!
POSTED BY: Silvia Hao
Posted 9 years ago

Hello Arnoud, I installed Mathematica yesterday and wanted to connect it to my Raspberry Pi. I also have the same problem as described in the above posts:

From my Mac I can ssh to my RasPi and launch there Wolfram, and make it add 1+1. But I can't figure out how to get a connection to the RasPi from Mathematica on my Mac using the RDK.

In the setup mask of the RDK (Configure Pi Connection) I entered

Network machine of Pi: IP address of the WLAN connection of my RasPi (as said, this one works for connecting via ssh)

Login of Pi: pi

I my point of view there is not much that the user can do there wrong, it should work out of the box.

When I try to connect to my RasP and evaluate the Pi Test & Example notebook I am asked to enter my password for my pi login, I have to wait then quite a while, then I get the following two errors:

The child process 594 reports: sh: Private: command not found

The kernel Raspberry Pi failed to connect to the front end. (Error = MLECONNECT). You should try running the kernel connection outside the front end.

When I enter Options[$FrontEnd, EvaluatorNames] on my local desktop I get

In[2]:= Options[$FrontEnd, EvaluatorNames]

Out[2]= {EvaluatorNames -> {"Local" -> {"AutoStartOnLaunch" -> True}, "Raspberry Pi" -> {"RemoteMachine" -> True, "TranslateReturns" -> True, "AutoStartOnLaunch" -> False, "Executable" -> "/usr/bin/wolfram", "HostName" -> "", "RemoteLogin" -> "pi"}}}

I googled the problem but couldn't find anything that would solve my connection problem. I would be very happy if you could help me with this issue.

Kind Regards Björn

POSTED BY: Björn Forster
Hi Arnoud,

I'm having a similar problem as Arvind's when trying to run test code from the RDK.

The kernel is setup by the RDK automatically:
 {EvaluatorNames -> {
    "Local" -> {"AutoStartOnLaunch" -> True},
    "Raspberry Pi" -> {"RemoteMachine" -> True,
                       "TranslateReturns" -> True,
                       "AutoStartOnLaunch" -> False,
                       "Executable" -> "/usr/bin/wolfram",
                       "HostName" -> "",
                       "RemoteLogin" -> "pi"}
POSTED BY: Silvia Hao
Arvind, what is the output you get when you evaluate:


on your (desktop) Mathematica?
POSTED BY: Arnoud Buzing
Thanks Arnoud. I could get this working - but I was trying to get the Mathematica  kernel running from command line. I downloaded the Remote Development Kit ( from here: - which according to the description should allow remote execution of Mathematica code on a kernel running in the Pi (if my understanding is correct). When I try to run the provided Rasberry Pi example - I get an error message to the effect that it is not able to connect to a remote kernel on the Pi. It got me thinking that maybe I need to have an instance of the Mathematica kernel running on the Pi before I attempted to run any Mathematica code remotely. 
Please let me know if you have any pointers.


You can ssh to your remote Pi from your desktop and type 'wolfram' at the prompt: 
> wolfram
Wolfram Language (Raspberry Pi Pilot Release)
Copyright 1988-2013 Wolfram Research
Information & help:

(Let me know if this is not what you are trying to do)
POSTED BY: Arnoud Buzing
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract