Ask Your Question

Why is a png viewer not loading?

asked 2022-09-06 14:19:01 +0100

OpenSauceCool gravatar image

updated 2022-09-06 17:24:30 +0100

FrédéricC gravatar image

Question 54175 is the same issue highlighted previously without solution.

This is so frustrating as it's the first time I'm using Sage and the whole process has been incredibly annoying to set up and I can't even view my plot!

I'm using SageMath 9.6, using Ubuntu on Windows.

Here's my code:

sage: vector_field(X, Y) = (0.9*X - 0.5*Y, 0.1*X + 0.8*Y)
sage: p = plot_vector_field(vector_field,
....:                       (X, -2, 2), (Y, -2, 2),
....:                       frame=False,
....:                       color="green",
....:                       plot_points=10,
....:                       axes_labels=("$X$", "$Y$"))
sage: show(p, aspect_ratio=1, figsize=5)
Launched png viewer for Graphics object consisting of 1 graphics primitive

But no png viewer is launched!

edit retag flag offensive close merge delete



are you using Virtual box or WSL? For WSL, Did you install X11 for windows and configure it? "Install a X server for Windows Configure bash to tell GUIs to use the local X server" see as an example and this page and also see Mircosoft WSL pages on how to do this.

Nasser gravatar imageNasser ( 2022-09-06 21:04:44 +0100 )edit

Using WSL. I tried configuring following the first link, but I get the error Can't open display: localhost:0.0.

OpenSauceCool gravatar imageOpenSauceCool ( 2022-09-07 12:52:09 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2022-09-07 07:30:28 +0100

ortollj gravatar image

Another solution is to use Jupyter notebook (here Ubuntu WSL in W11) image description

edit flag offensive delete link more


After install jupyter notebook, I run the code ./sage -n jupyter
To open a jupyter notebook with sage, this works. Many thanks!

OpenSauceCool gravatar imageOpenSauceCool ( 2022-09-07 13:24:57 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-09-06 14:19:01 +0100

Seen: 319 times

Last updated: Sep 07 '22