Test Plots on Travis: GKS can't open display

question
ci

#1

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?


#2

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.


#3

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)


#4

… These two Lines should fix the Problem - yes


#5

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


#6

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


#7

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


#8

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:


#9

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?


#10

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.


#11

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.


#12

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.