lfortran in a jupyter notebook kills kernel

I can't seem to get output from the lfortran jupyter kernel.

I installed via conda install for:

  - lfortran
  - jupyter

I can run jupyter and select the lfortran kernel. However:

Hello World does nothing

I see no hello world and also no error.

If in a second cell I call new it crashes the kernel.


The global scope in LFortran is special to enable interactivity and usage in a notebook and defines a set of additional rules. You actually don't need a program body to run any Fortran code there, just using the print statement directly will work:

print *, "Hello world!"

The extensions to Fortran available are described here.

Further, a program itself is not supposed to be callable, rather it should execute directly after being declared (this might be a bug in LFortran, reported it in lfortran#648). Instead you might want to declare a subroutine:

subroutine new
  print *, "Hello world!"
end subroutine new

And than run it with

call new