13
$\begingroup$

Recently I bought a Raspberry Pi and I installed the Wolfram Language on it. Comparing WL 10.0's commands with Mathematica 9.0.1.0's commands, I found 328 additional commands and variables. I understand that WL is in a preliminary version so more commands may be added (or removed) in the near future but since this seems to be the future, I believe learning as quickly as possible the new possibilities would be a strong asset.

Since my PC's front end is much faster than the RPi's, I would like to call these through my Mathematica 9.0.1 front end and get the results in the same front end. This would save a lot of time lost in going forward-backward between them. So how can I call the WL kernel from my PC (I have attached both to an Ethernet LAN)?

$\endgroup$
21
  • 1
    $\begingroup$ When you say your PC is so much faster than the Pi is that for running mathematica/WL code? Because if you do succeed in making the connection you desire the code will still be running on the Pi and just as slow. The only gain you will make is convenience of not having to switch. $\endgroup$
    – Ymareth
    Commented Feb 25, 2014 at 14:43
  • $\begingroup$ Asking users to comment on some 100-200 new functions is waay too broad and perhaps out of scope for this site. Besides, there is documentation for a lot of these (but not all) available online, so I don't see why you couldn't just look them up. Third, you can't run the functions available in the WL kernel on your Pi in Mathematica 9 on your PC... that's just not how it works. Besides, even if it were possible, it would probably be a violation of the license, so people might not answer that question here. $\endgroup$
    – rm -rf
    Commented Feb 25, 2014 at 14:43
  • $\begingroup$ Yes I know - I just want to call the new commands from 9.0 in my PC. I don't mind the delay. $\endgroup$
    – tchronis
    Commented Feb 25, 2014 at 14:44
  • 2
    $\begingroup$ I'm looking forward to version 10 too. But you know, I still haven't mastered all the commands that were new in version 7 yet! $\endgroup$
    – bill s
    Commented Feb 25, 2014 at 14:45
  • $\begingroup$ @rm -rf I hope there is no license problem. I am a licensed MMA 9.0 user and I would like to explore the new commands from a more robust environment. It is well known that Pi's xwindows are very heavy for it. So I cannot build notebooks larger than a few kb. To produce the help file took 30 minutes. $\endgroup$
    – tchronis
    Commented Feb 25, 2014 at 14:48

2 Answers 2

14
$\begingroup$

You can download the Remote Development Kit here (scroll down a bit).

It's a CDF file that shows this when opened:

Click "INSTALL" to finish the installation.

Now go to Palettes -> Remote Development Control Panel.

Click Configure Pi Connection and enter the IP address of your Pi, as well as the default username.

Click New Pi Notebook, enter an expression to evaluate and press Shift-Enter. A dialog will come up to enter the password for the Pi.

Now you're ready to work with the Pi kernel and a desktop front end!

This works both for front end version 9 and 10.

This sets up a remote kernel with almost the same configuration bobthechemist describes in his answer, however he runs the kernel as root on the Pi, which allows access to hardware (e.g. GPIO).

If this method doesn't work, verify that it is possible to connect to the Pi using ssh from a terminal.

$\endgroup$
5
  • $\begingroup$ +1 for putting all the information in a convenient spot. Seems like folks who gather in WC have problems getting this option to work. Another case of YMMV. $\endgroup$ Commented Jul 11, 2014 at 16:21
  • $\begingroup$ @bobthechemist Do I see it correctly that the only difference between this and your configuration is that you ran the Pi kernel as root? $\endgroup$
    – Szabolcs
    Commented Jul 11, 2014 at 16:44
  • $\begingroup$ Yes - the benefit of running the kernel as root is to get access to commands such as DeviceWrite["GPIO", {24->1}]. $\endgroup$ Commented Jul 11, 2014 at 16:49
  • 1
    $\begingroup$ I tried to connect to my pi from a remote network. I usually connect to the Pi with ssh -p 22000 pi@ip_address because I changed the default SSH port to avoid brute force attacks. I changed the launch command to java -jar "mathssh" -p 22000 pi@ip_address /usr/bin/wolfram -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "linkname" -LinkHost ipaddress but I can't connect to it. Am I doing it wrong? $\endgroup$
    – shrx
    Commented Aug 20, 2014 at 13:02
  • $\begingroup$ I found this: quiterandomnotes.blogspot.com/2013/04/… Looks like it's a problem that I'm behind a router and I'll have to set up a VPN. Not that I know how to do it... $\endgroup$
    – shrx
    Commented Aug 20, 2014 at 13:56
6
$\begingroup$

It is possible to connect to the RPi through a PC running v9 using the remote kernel options

  1. From "Kernel Configuration Options..." Add a new kernel
  2. Choose the Advanced options and ensure that Arguments to MLOpen has the following

-LinkMode Listen -LinkProtocol TCPIP -LinkOptions MLDontInteract

and the Shell command to launch kernel is

"`java`" -jar "`mathssh`" [email protected] sudo wolfram -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "`linkname`" -LinkHost `ipaddres`

Obviously, replace your ipaddress as appropriate. The sudo in the kernel launch will allow you to use DeviceWrite functions that access the GPIO; in my opinion one of the main reasons to run Mathematica on a RPi.

As a side note, if you are running avahi you can substitute hostname.local for the ipaddress and not worry about when and if your RPi IP address changes. This may require you to have Apple's bonjour software installed on your PC; however, I was unable to test if this is a requirement since I already had it installed in my case.

One last note; if you encounter problems with SSH keys, you want to look at c:\USERS\$USERNAME.ssh and delete the entries that are causing problems.

$\endgroup$
1
  • $\begingroup$ Thanks @bobthechemist. I could get everything up to just before the request for the password dialogue box - the MLECONNECT error just kept appearing -, I could successfully SSH into the pi but the dialogue box requesting password just would not show. I replaced the auto-generated options with the following (plus my details) and everything started working. "java" -jar "mathssh" [email protected] sudo wolfram -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "linkname" -LinkHost ipaddres $\endgroup$ Commented Dec 12, 2014 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.