It seems that the main reason is that the $DISPLAY environment variable is not set.
first make sure $DISPLAY installed when you start your Jupyter laptop. You may also need to direct mpirun to export it to all MPI tasks.
starting with Open MPI 3.0.0, you can achieve this with export OMPI_MCA_mca_base_env_list=DISPLAY before working with a Jupyter laptop
By the way, should your application open the X screen? If it does not make graphics, then it can be adjusted to work properly when the display is not available.
[ADDITION]
Another possibility is that gmsh considers the display to be accessible since DISPLAY installed, so it tries to open it and fails. You can try to disable this environment variable and see how everything happens, both from the command line (for example, in interactive mode), and through a laptop (for example, batch mode)
source share