Test Plots on Travis: GKS can't open display



I’m trying to test Plots on Travis and I get this:

GKS: can't open display on ""
     Is your DISPLAY environment variable set correctly?
     Did you enable X11 and TCP forwarding?
GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS

followed by a segmentation fault.
Any idea how to remedy this?


Please refer to the Plots Test scripts. You have to tell Plots/GR, that you are on a headless system and set PLOTS_TESTS=true and GKSwstype=100.


Awesome, thank you! Testing this now.
I’m not sure if you meant anything other than adding these two lines to the runtests.jl file:

ENV["PLOTS_TEST"] = "true"
ENV["GKSwstype"] = "100"

Or if there is anything else peculiar I need to add to the .travis.yml file.

(I also specify default(show=false) because none of my plots are actually displayed, they are all being saved to file)


… These two Lines should fix the Problem - yes


Thank you so much for your help. Unfortunately, I’m still getting the segmentation fault… Has to be related somehow.


In case you want to take a close look, here’s the repo: https://github.com/yakir12/Saves.jl


Please set the environment varaiables before you include or start Plots related stuff…


The segmentation fault is till there. I moved the two lines all the way to the top of the test file. I really appreciate any additional insight you might have, I obviously need it :spongebob:


Could you try an “intrinsic” format to save your plots (e.g. PDF or SVG), just to ensure, that the problem is Cairo-specific. If so, did you try the test on a local machine or, do you have a MWE to reproduce the segfault?


Gladly. I’ll be able to try that tonight (in 7 hours).
It works perfect locally. I’ll try distilling it to a MWE tonight as well.


Right, so just plotting one simple plot and saving it to SVG worked. But I’m after creating a gif or mp4 (so a bitmap not a vector graphic). Hmm, I’ll keep fiddling.


I played with a really clean version. While it finally worked on Linux, it didn’t on osx, the reason being that I can’t install ffmpeg via Travis on an osx. I checked with Plots to see how they do it, and they don’t. The tests for osx are skipped.
Not sure how to proceed…

Here’s the repo: https://github.com/yakir12/Saves.jl
Ignore this line, it was my feeble attempt to install ffmpeg on the mac.