# Generation of documentation fails: "qt.qpa.xcb: could not connect to display"

**URL:** https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988
**Category:** Package Management
**Tags:** documenter
**Created:** [May 12, 2021, 12:26am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988 "2021-05-12T00:26:43Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [May 12, 2021, 12:26am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/1 "2021-05-12T00:26:43Z")

</div>

I am able to generate the documentation locally, but when I try to do so on Github I get the following errors during execution of `make.jl`:

```julia
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, vnc, xcb.

Aborted (core dumped)
connect: Connection refused
GKS: can't connect to GKS socket application

```

The package is [PSSFSS.jl](https://github.com/simonp0420/PSSFSS.jl) and the documentation build log is [here](https://github.com/simonp0420/PSSFSS.jl/runs/2561085146?check_suite_focus=true)  
I thought it was allowed to include plots in the online generated documentation. Is that correct? If that’s not it, then I could sure use some help debugging this. Thanks in advance.

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [May 12, 2021, 1:20am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/2 "2021-05-12T01:20:04Z")

</div>

I see you’re using Plots.jl, and “GKS” sounds like the GR backend. In that case, set the magic environmental variable

```julia
ENV["GKSwstype"] = "100"

```

which tells it to operate in “headless” mode where it doesn’t expect an active display connected. (AFAIK this is undocumented but it’s super useful!).

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [May 12, 2021, 2:26pm UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/3 "2021-05-12T14:26:20Z")

</div>

Thanks! That did the trick (for that error, at least).

---

<div class="post-metadata">

### Author: ![SeSodesa](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@SeSodesa](https://discourse.julialang.org/u/SeSodesa)
#### Post date: [July 18, 2021, 8:37am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/4 "2021-07-18T08:37:45Z")

</div>

For anyone wondering where this information originated from, see [Workstation Types — GR Framework 0.66.0 documentation](https://gr-framework.org/workstations.html#no-output).

---

<div class="post-metadata">

### Author: ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)
#### Post date: [September 7, 2021, 1:29am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/5 "2021-09-07T01:29:04Z")

</div>

@PeterSimon and @ericphanson  
I have the same problem as @PeterSimon initially described.  
So, which file should I add the line `ENV["GKSwstype"] = "100"` ? Should it be in `docs/make.jl`?  
Thanks a lot in advance!

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [September 7, 2021, 2:33am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/6 "2021-09-07T02:33:35Z")

</div>

For generating documentation it goes in the `env:` section of your `CI.yml` file.  
See, for example [these lines](https://github.com/simonp0420/PSSFSS.jl/blob/9d9a69b0e86f51ac261b6f55ce26d6305127a3f9/.github/workflows/CI.yml#L64-L67)

---

<div class="post-metadata">

### Author: ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)
#### Post date: [September 7, 2021, 6:24am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/7 "2021-09-07T06:24:02Z")

</div>

@PeterSimon, thanks. I followed exactly what you said, and checked your CI.yml in PSSFSS.jl. Yet, I got the same error as before:

```julia
Run julia --project=docs/ docs/make.jl
  julia --project=docs/ docs/make.jl
  shell: /usr/bin/bash -e {0}
  env:
    GITHUB_TOKEN: ***
    DOCUMENTER_KEY: 
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, vnc, xcb.

Aborted (core dumped)
connect: Connection refused
GKS: can't connect to GKS socket application
...

```

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [September 7, 2021, 8:49am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/8 "2021-09-07T08:49:22Z")

</div>

I put it there, yeah.

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [September 7, 2021, 4:34pm UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/9 "2021-09-07T16:34:04Z")

</div>

> [@BVPs](#):
>
> env:  
> GITHUB\_TOKEN: \*\*\*  
> DOCUMENTER\_KEY:

You don’t explicitly show that you included the `GKSwstype` environment variable. Could you provide a link to your Github CI.yml file so we can look it over?

---

<div class="post-metadata">

### Author: ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)
#### Post date: [September 7, 2021, 5:17pm UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/10 "2021-09-07T17:17:20Z")

</div>

@PeterSimon ; thanks a lot. Here is the link to our CI.yml: [MultiscaleGraphSignalTransforms.jl/CI.yml at master · UCD4IDS/MultiscaleGraphSignalTransforms.jl (github.com)](https://github.com/UCD4IDS/MultiscaleGraphSignalTransforms.jl/blob/master/.github/workflows/CI.yml)

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [September 7, 2021, 5:45pm UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/11 "2021-09-07T17:45:26Z")

</div>

Your CI.yml file looks OK to me (though I am far from an expert on this).  
When I look at your log files, I see that the GKSwtype environment variable is not set during your documentation run. (You apparently copied a portion of the log file in your last post.) I am by no means proficient at this stuff, but I do notice that your listing shows

```julia
env:
GITHUB_TOKEN: ***
DOCUMENTER_KEY:

```

There are no asterisks after `DOCUMENTER_KEY` as there are after `GITHUB_TOKEN`. In the log file for my project, there are asterisks after both of these. I am totally speculating here, but perhaps you didn’t set up `DOCUMENTER_KEY` and maybe this caused the setting of the environment variables to be terminated before reaching `GKSwstype` setting. If this isn’t it, then perhaps someone more expert on these matters can help you.

---

<div class="post-metadata">

### Author: ![BVPs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bvps/32/2190_2.png) [@BVPs](https://discourse.julialang.org/u/BVPs)
#### Post date: [September 7, 2021, 10:05pm UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/12 "2021-09-07T22:05:05Z")

</div>

Thanks a lot! After all, I forgot that I have another yml file called `Documenter.yml` under `.github/workflow/`, which deals with everything related to the docs. I added that magic line under the `env` item, it worked!

---

<div class="post-metadata">

### Author: ![iiisoo](https://avatars.discourse-cdn.com/v4/letter/i/ecd19e/32.png) [@iiisoo](https://discourse.julialang.org/u/iiisoo)
#### Post date: [October 28, 2021, 3:27am UTC](https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/13 "2021-10-28T03:27:44Z")

</div>

When I use this line in my julia, it starts to not showing the graph. Where does the graph go?
