I’ve been experimenting with the Julia programming language and I tried following this example exercise of theirs: http://nbviewer.jupyter.org/github/JuliaLang/ODE.jl/blob/master/examples/Lorenz_Attractor.ipynb. Now, I should be clear in saying, I didn’t use the notebook interface, rather I copy-pasted this into a Julia script named Lorenz.jl and executed it in Julia by launching Julia and running:
include("Lorenz.jl")
, after a little wait this returned:
1-element Array{PyCall.PyObject,1}:
PyObject <mpl_toolkits.mplot3d.art3d.Line3D object at 0x7fa10d005f28>
and that was it (no plot window popped up). I should clarify, and say that before I ran the script I, of course, installed the ODE and PyPlot Julia modules (otherwise I would have received an error in the aforementioned Julia command-line output). On other distros (Arch and Fedora 29 for starters) a window pops up after the Lorenz.jl script, at the same time as that output comes out at the command-line. Now before you point out the obvious and say I’m missing python3-matplotlib, I’m not, I have it installed (which I largely installed because without it installing the PyPlot Julia module fails to build), I even tried installing plplot and python3-matplotlib-qt5, as I feared it might be needed.
Funny thing is I even tried out running xhost +, chrooting into my Arch install (with mount -t proc /proc /arch/proc, mount --rbind /dev … and so forth done first), running:
export DISPLAY=":0"
julia
, then in Julia running this same script and even from this chroot Arch managed to launch the Matplotlib window.
Does anyone have any idea how I might fix this error?
You need to verify you’ve installed required components correctly and that each are working.
Test PyPlot using a common test in particular
You probably need to understand whether you’ve installed Julia correctly, apparently you can implement as a Julia runtime or run through a Julia binary.
You may need to instrument your code to understand where the problem is, from what you posted a guess is that it’s somewhere between your Julia output and being received by PyPlot… but of course that’s only a guess without being more familiar with Julia. At least as you say, you have some working instances to compare.
Which components? Do you mean the Julia modules? I’ve tried clearing the ~/.julia directory and reinstalling, I’ve also tried downloading the binary tarball (from https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.2-linux-x86_64.tar.gz), decompressing it, removing ~/.julia again, re-installing the modules and attempting to plot, but I received the same problem. I followed the same procedure as I do on other distros and on other distros the plot works fine. Here’s some code that I’ve tested on several distros, that installs PyPlot, and then runs an example; on other distros it creates a plot window, but on Tumbleweed it doesn’t.
using Pkg;
Pkg.add("PyPlot")
using PyPlot
n=0:1:10 ;
x=cos.(pi*n/10);
y=acos.(x*1/10);
plot(x,y)
feel free to try it out yourself, I wonder if this is reproducible on other people’s systems. If this code is working you should see a window named “Figure 1” that pops up and shows:https://imgur.com/nLVnM3F.pngWhat is shown at the command-line if all is well is:
(except maybe some differences in things that differ between systems like the 0x7f35c5159da0 on the final line and in the d330b81b-6aea-500a-939a-2ce795aea3ee).
If you’re having problems running PyPlot tests, that’s a possible clue where the problem might be.
An option is to install your scientific apps using Anaconda or Mini-conda…
Each installs as its own independent directory tree which is then prepended to your PATH, thereby making sure each conda app and its dependencies priority over anything installed in the main parts of your system.
And then, should you decide to uninstall, you only have to delete the directory tree and remove the PATH entry.
If that solves your problem,
I’m sure the community would appreciate your submitting a related bug to https://bugzilla.opensuse.org.
Well I’ll be …, I deleted ~/.julia again, installed Python 3.6 and Matplotlib using Anaconda, adjusted my environment variables, started Julia again and then at the Julia prompt I ran the example script again and this time the plot worked. So it is time to report this pesky little bug. Thank you for your help, for some reason even though I knew of Anaconda it didn’t occur to me that this might be a workaround.