Gtk initialization failed for display ":0"

63 views
Skip to first unread message

Shriram Krishnamurthi

unread,
Jul 11, 2020, 12:26:48 PM7/11/20
to Racket Users
I'm running headless Racket from a Docker container for auto-grading assignments in Gradescope.

The students are writing BSL programs with 2htdp/image. This does not cause any problems for most of them.

Two students, however, get an error in file loading with the error message in the subject line («Gtk initialization failed for display ":0"»).

I finally localized the problem: it's because they are using the universe Teachpack.

I don't know what in universe is causing this, but it seems rather weird that image, which is fundamentally graphical, does not cause this problem but universe, which is it fundamentally not, does.

Furthermore, this dependency means that any program that depends on universe would likely not be able to be auto-graded (at least in a Gradescope-like headless context), which seems a rather severe restriction. (And ironic, given that the design of universe is to enable testing, and hence also auto-grading.) I don't know how Northeastern does auto-grading of universe that gets around this, but it's clearly in a different setting.

I don't have a "question" because I seem to have identified the base issue here. This is mostly here for future reference, since I saw some posts from looking for that string that didn't answer my need (but were still useful in indicating it might be a dependency), so I'm leaving this here for a future person who might be searching.

However, it would also be nice if the universe Teachpack could avoid this dependency entirely or refactor it into parts that do and don't need it.

Shriram

Sam Tobin-Hochstadt

unread,
Jul 11, 2020, 12:34:21 PM7/11/20
to Shriram Krishnamurthi, Racket Users
The usual solution to this problem is to use xvfb to create a virtual display, which works great in this situation when the display is not really needed anyway. This is how we run the handin server headless and how all the racket CI works. 

Sam

--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/7e2da814-25e5-4547-b5d9-2c66c087f37eo%40googlegroups.com.

Matthew Flatt

unread,
Jul 11, 2020, 12:36:39 PM7/11/20
to Shriram Krishnamurthi, Racket Users
At Sat, 11 Jul 2020 09:26:47 -0700 (PDT), Shriram Krishnamurthi wrote:
> I'm running headless Racket from a Docker container for auto-grading
> assignments in Gradescope.
>
> The students are writing BSL programs with 2htdp/image. This does not cause
> any problems for most of them.
>
> Two students, however, get an error in file loading with the error message
> in the subject line («Gtk initialization failed for display ":0"»).
>
> I finally localized the problem: it's because they are using the universe
> Teachpack.
>
> I don't know what in universe is causing this, but it seems rather weird
> that *image*, which is fundamentally graphical, does not cause this problem
> but *universe*, which is it fundamentally not, does.

It's helpful help to distinguish between "images" and "GUIs". The
`2htdp/image` library is only about drawing images, so it doesn't need
a GUI context. The `2htdp/universe` library deals with windows and
mouse clicks, so it needs a GUI context.

> Furthermore, this dependency means that any program that depends on
> universe would likely not be able to be auto-graded (at least in a
> Gradescope-like headless context), which seems a rather severe restriction.
> (And ironic, given that the design of universe is to enable testing, and
> hence also auto-grading.) I don't know how Northeastern does auto-grading
> of universe that gets around this, but it's clearly in a different setting.

Following up on Sam's suggestion, I recommend `xfvb-run` as something
like

xfvb-run racket -l handin-server


Matthew

Matthew Flatt

unread,
Jul 11, 2020, 12:41:13 PM7/11/20
to Shriram Krishnamurthi, Racket Users
At Sat, 11 Jul 2020 10:36:33 -0600, Matthew Flatt wrote:
> Following up on Sam's suggestion, I recommend `xfvb-run` as something
> like
>
> xfvb-run racket -l handin-server

Should be `xvfb-run`. I always have trouble getting those letters in
the right order.

Wayne Harris

unread,
Jul 14, 2020, 6:59:02 AM7/14/20
to racket...@googlegroups.com
We'll post on [f]ace[b]ook all your spelling mistakes! (You'll be
horrified!)

Wayne Harris

unread,
Jul 14, 2020, 10:30:29 AM7/14/20
to racket...@googlegroups.com

Wayne Harris

unread,
Jul 14, 2020, 10:30:30 AM7/14/20
to racket...@googlegroups.com
We'll post on [f]ace[b]ook all your spelling mistakes! You'll be horrified!

Reply all
Reply to author
Forward
0 new messages