title: How to run MPI compatible applications from Jupyter notebooks?
body: <p>So I have a trobule with <code>gmsh</code>.</p>
  
  <p>Direct execution works fine:</p>
  
  <pre><code>!gmsh -3 -algo meshadapt tmp_0.geo -o SFM.msh
  </code></pre>
  
  <p>While execution from code fails:</p>
  
  <pre><code>try:
      out = subprocess.check_output(
              ["gmsh", "gmsh -3 -algo meshadapt tmp_0.geo -o SFM.msh"],
              stderr=subprocess.STDOUT
              ).strip().decode('utf8')
  except subprocess.CalledProcessError as e:
      out = e.output
  print(out)
  </code></pre>
  
  <p>with:</p>
  
  <blockquote>
    <p>b"--------------------------------------------------------------------------\n[[23419,1],0]: A high-performance Open MPI point-to-point messaging module\nwas
    unable to find any relevant network interfaces:\n\nModule: OpenFabrics
    (openib)\n  Host: 931136e3f6fe\n\nAnother transport will be used
    instead, although this may result in\nlower
    performance.\n--------------------------------------------------------------------------\n\x1b[1m\x1b[31mFatal   : Can't open display:  (FLTK internal
    error)\x1b[0m\n--------------------------------------------------------------------------\nMPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD \nwith errorcode
    1.\n\nNOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.\nYou may or may not see output from other processes,
    depending on\nexactly when Open MPI kills
    them.\n--------------------------------------------------------------------------\n"</p>
  </blockquote>
  
  <p>So how to emulate <code>!</code> execution in jupyter from Python 3 code?</p>
  
  <hr>
  
  <p>@Hristo:</p>
  
  <blockquote>
    <p>_=/opt/conda/bin/jupyter SHLVL=1 PATH=/opt/conda/bin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    HOSTNAME=931136e3f6fe HOME=/root LC_ALL=C.UTF-8 PWD=/ JPY_PARENT_PID=1
    LANG=C.UTF-8 TERM=xterm-color CLICOLOR=1 PAGER=cat GIT_PAGER=cat
    MPLBACKEND=module://ipykernel.pylab.backend_inline env DISPLAY=:0 gmsh
    -3 -algo meshadapt tmp_0.geo -o SFM.msh</p>
  </blockquote>
  
  <p>@Gilles:
  Same result.</p>