3
$\begingroup$

I'm running a Mathematica script on a remote machine (via ssh connection). I log on the machine and I execute math -script algorithm.m and this message appears

FrontEndObject::notavail: A front end is not available; certain operations require a front end. Launching kernels...

I think the message of the FrontEndObject is only a warning and it's not a particular issue. My problem is that this computation takes 20 seconds and outputs a .txt file but the message Launching kernels... etc stays forever until I press Ctrl-C. At that point I can see again my command prompt and, indeed, I find that the output is there and it's been there for minutes.

Any clue?

Edit:

The problem is not the Warning of the FrontEnd Object (for which I solved the issue), the problem is the fact that the line Launching Kernels... stays forever and I don't get to have the command prompt back.

My program consists simply on a function GeneticAlgorithm[x1_, x_2, x_3] that has already been used multiple times in my group by other phd students and it works. I added just two lines to run the program on a remote machine, namely:

Export["prova.txt", Timing[GeneticAlgorithm[x1,x2,x3]]]; Print["ciao"];

So basically my program is:

GeneticAlgorithm[x1_, x_2, x_3] :=*definition of the function* Export["prova.txt", Timing[GeneticAlgorithm[x1,x2,x3]]]; Print["ciao"];

As I run the program, the output prova.txt is created and the line "ciao" appears on the terminal. But nothing else happens, and I don't get my command prompt back. I tried to add Exit[]or Quit[]to the end of my program but the problem remains.

$\endgroup$
  • 2
    $\begingroup$ The most common operation that requires a front end is Export (only with certain formats, but always with graphics). Possible duplicate: mathematica.stackexchange.com/q/136574/12 $\endgroup$ – Szabolcs Jul 6 '18 at 15:10
  • 1
    $\begingroup$ The problem is not the front end (indeed, I found the graphical object and I removed it, thanks Szabolcs). The problem is the fact that the line Launching kernels...stays forever and I don't get the command line back. Even if the evaluation is finished. I tried to add End[] to my program but it didn't work. I will modify my question to be more clear and to better highlight my issue $\endgroup$ – Luthien Jul 6 '18 at 15:32
  • $\begingroup$ You need to provide a complete minimal example then ... otherwise people have no chance at guessing what is going on. Also, if you do not know what a command does, do not add it to your program at random. End[] has no place here (see documentation for what it does). $\endgroup$ – Szabolcs Jul 6 '18 at 16:52
  • $\begingroup$ Try math -initfile ... perhaps $\endgroup$ – barrycarter Jul 7 '18 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.