14
$\begingroup$

Configuring a remote kernel with the Kernel Configuration Basic Options I manage to have a new kernel in the list of the kernel that I can open. However when I start the new kernel I get asked for the password and then nothing happens ...

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

My connection works both via ssh and via java ... "java -jar /Applications/Mathematica.app/SystemFiles/Java/WolframSSH.jar user@host path/MathKernel"

Any suggestions or a less basic command that gives more info on the reasons of the failure of this connection?

Thanks, Roberto

$\endgroup$
2
  • $\begingroup$ Could you find a way out of this error? $\endgroup$
    – Rojo
    Commented Jan 13, 2014 at 23:26
  • $\begingroup$ no :( still coping with that ... $\endgroup$
    – Rho Phi
    Commented Oct 28, 2015 at 16:28

2 Answers 2

4
$\begingroup$

This solution is tested for M11.2 for macOS client and Linux server.

  1. Create a password-less ssh login. Generated a public and private ssh key on the local machine (mac) and then copy the public key to the remote machine.

  2. Download packages from here.

  3. Copy the file init.m to the directory ~/.Mathematica/Kernel/ directory on the remote machine.

  4. Copy the file tunnel.sh to the directory ~/Library/Mathematica/FrontEnd/ on the local machine.

  5. In Mathematica, go Evaluation => Kernel Configuration Options => Add.

    • Select "Advanced Options"
    • Arguments for MLOpen:
      -LinkMode Listen -LinkProtocol TCPIP -LinkOptions MLDontInteract -LinkHost 127.0.0.1
    • Arguments for Launch command:
      "/Users/Account/Library/Mathematica/FrontEnd/tunnel.sh" [email protected]:port "wolfram" "`linkname`"
    • where Account must be your user name on the macOS.
    • where user by login in remote machine;
    • where remote.machine by ip address of remote machine;
    • where port by ssh port of remote machine.
    • Also make sure that wolfram command is available on the remote machine.
  6. Be patient, since establishing connections can take time. You can find a log file at ~/Library/Mathematica/FrontEnd/
$\endgroup$
2
  • $\begingroup$ Updated version is here: github.com/sakra/Tunnel $\endgroup$
    – Szabolcs
    Commented Oct 4, 2017 at 11:24
  • $\begingroup$ Connection works but all Dynamic content is broken. $\endgroup$
    – swish
    Commented Mar 13, 2018 at 11:46
3
$\begingroup$

tl;dr If you use macOS and there are spaces in the path to (or name of) the Mathematica app, remove those spaces!


I believe that this error is shown when the process started by the Front End (that is supposed to eventually launch the kernel) exits, and no kernel has connected back to the Front End.

If you see the error immediately after trying to start up the kernel, then the problem is very likely not with the network connection between the Front End and the Kernel computers, and the advice in @Karolis's answer will not work.

One problem could be that the Front End is unable to launch the ssh program to connect to the remote machine. This is exactly what happens on macOS when there are spaces in the path to the Mathematica app. For example, I have several versions of Mathematica installed, and they are named similarly to "/Applications/Mathematica 11.2.app".

If you go into the kernel configuration options, and set it to advanced mode, you will see a launch command starting with

`java` -jar "`wolframssh`" user@host ...

The special templates `java` and `wolframssh` expand to paths like

/Applications/Mathematica 11.2.app/Contents/SystemFiles/Java/MacOSX-x86-64/bin/java

and

/Applications/Mathematica 11.2.app/Contents/SystemFiles/Java/WolframSSH.jar

and in the process, something goes wrong with the quoting or escaping of the spaces in the paths.

To fix this, either eliminate the spaces, or manually enter the paths. E.g., if you already have Java installed,

java "/Applications/Mathematica 11.2.app/Contents/SystemFiles/Java/WolframSSH.jar" user@host ...

will be fine. If you use public key authentication and do not need to type a password to connect, then you may use the system's ssh instead of Wolfram's:

ssh user@host ...
$\endgroup$

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.