scalanlp / breeze

Breeze is/was a numerical processing library for Scala.
https://www.scalanlp.org
Apache License 2.0
3.45k stars 691 forks source link

Breeze-vis headless - without GUI #699

Closed andb0t closed 6 years ago

andb0t commented 6 years ago

Hi all,

I'm developing on WSL (the windows subsystem for Linux), which is a full Ubuntu system, but without X server access (yet). So in a way it's like a jenkins container without X server. The problem I'm having when trying to create and save plots (just the simple example from the Quickstart guide is this:

[error] (run-main-136) java.awt.HeadlessException:
[error] No X11 DISPLAY variable was set, but this program performed an operation which requires it.

Is the X server necesary for the plot creation or is there a work-around? Or anything you an advise me to google to fix it?

Cheers!

darrenjw commented 6 years ago

Set

f.visible=false

immediately after

val f = Figure()
andb0t commented 6 years ago

This breaks already:

    val f = Figure()
    println("Before")
    f.visible= false
    println("After")
    val p = f.subplot(0)

results in

Before
[error] (run-main-13a) java.awt.HeadlessException:
[error] No X11 DISPLAY variable was set, but this program performed an operation which requires it.
darrenjw commented 6 years ago

Sorry - yes - you're right. I thought I'd tested it, but I'd actually tested it in a cmd window rather than a bash window... There's probably a horrible hack for this where you run a dummy X server, but I don't have any other solution.

EvanOman commented 6 years ago

You can open an X Server Window with WSL no problem. Just install Xming X Server, run XLaunch, and add the following to your .bashrc file

# Setting for XServer windows 
export DISPLAY=:0

Doing so I am able to make the plots from the Quick Start:

image

andb0t commented 6 years ago

Brilliant, that works! Thanks a lot, guys!