Hey all,
I love all the work on Julia 1.0 and am looking forwarding to the language stabilizing.
I’m about to teach a class where we are (tentatively) going to use Julia 1.0 exclusively. This means we need to have plotting working
I like using PyPlot for plotting, so that’s my standard.
On my own dev (linux) box, I had a lot of issues getting plots working via Atom (just to recap, it seems like trying to do things from Atom and Uber juno in terms of installing Python packages has some weird interaction I don’t understand – or this was recently fixed in a new version of PyCall, not exactly sure). Today, I got it working
I wanted to see how many issues I’d have trying fresh new computer to prep for what I’d likely face trying to get 40-odd students to get it working for them.
Here are my notes as I worked through things from download of the 1.0 until everything was working
Notes on using Julia 1.0 on an Ubuntu install 17.10
Unzipped and ran julia-1.0.0/bin/julia
]update
(No updates, that was nice!)
Added Plots via ]add Plots
Got an error because curl wasn’t installed for GR and Plots
(Also, I started collecting more info at this point…)
Then
julia> using Plots; plot(Plots.fakedata(100,5))
Got
[ Info: Precompiling GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71]
/home/meng/.julia/packages/GR/fnyt8/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application
Did you start 'gksqt'?
[[[and a bunch more errors]]]
Eek, that seems complicated to fix. And I like PyPlot better, let’s focus our energy there.
Then I tried
julia> pyplot()
That failed because PyPlot wasn’t installed
Next
]add PyPlot
(v1.0) pkg> add PyPlot
Resolving package versions...
Installed LaTeXStrings ─── v1.0.2
Installed Conda ────────── v1.0.1
Installed VersionParsing ─ v1.1.2
Installed PyPlot ───────── v2.6.0
Installed MacroTools ───── v0.4.4
Installed PyCall ───────── v1.18.0
Updating `~/.julia/environments/v1.0/Project.toml`
[d330b81b] + PyPlot v2.6.0
Updating `~/.julia/environments/v1.0/Manifest.toml`
[8f4d0f93] + Conda v1.0.1
[b964fa9f] + LaTeXStrings v1.0.2
[1914dd2f] + MacroTools v0.4.4
[438e738f] + PyCall v1.18.0
[d330b81b] + PyPlot v2.6.0
[81def892] + VersionParsing v1.1.2
Building Conda ─→ `~/.julia/packages/Conda/m7vem/deps/build.log`
Building PyCall → `~/.julia/packages/PyCall/WcrLS/deps/build.log`
┌ Error: Error building `PyCall`:
│ ERROR: LoadError: Couldn't find libpython; check your PYTHON environment variable.
│
│ The python executable we tried was python3 (= version 3.6);
│ the library names we tried were ["libpython3.6m.so", "libpython3.6m", "libpython3.6", "libpython"]
│ and the library paths we tried were AbstractString["/usr/lib", "/usr/lib", "/usr", "/usr/lib"]
│ Stacktrace:
│ [1] error(::String) at ./error.jl:33
│ [2] find_libpython(::String) at /home/meng/.julia/packages/PyCall/WcrLS/deps/build.jl:129
│ [3] top-level scope at logging.jl:313
│ [4] top-level scope at /home/meng/.julia/packages/PyCall/WcrLS/deps/build.jl:196
│ [5] include at ./boot.jl:317 [inlined]
│ [6] include_relative(::Module, ::String) at ./loading.jl:1038
│ [7] include(::Module, ::String) at ./sysimg.jl:29
│ [8] include(::String) at ./client.jl:388
│ [9] top-level scope at none:0
│ in expression starting at /home/meng/.julia/packages/PyCall/WcrLS/deps/build.jl:170
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1068
I tried showing the environment, but didn’t see anything that looked relevant to why it didn’t pick up the “install Python within Julia via Conda” python. I have this recorded in case someone wants to see what it was. I was expecting this to do the whole Conda install
Next set
julia> ENV["PYTHON"] = ""
(v1.0) pkg> build PyCall
Building Conda ─→ `~/.julia/packages/Conda/m7vem/deps/build.log`
Building PyCall → `~/.julia/packages/PyCall/WcrLS/deps/build.log`
(v1.0) pkg> add PyPlot
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[no changes]
Updating `~/.julia/environments/v1.0/Manifest.toml`
[no changes]
(v1.0) pkg> build PyPlot
Building Conda ─→ `~/.julia/packages/Conda/m7vem/deps/build.log`
Building PyCall → `~/.julia/packages/PyCall/WcrLS/deps/build.log`
julia> pyplot()
[ Info: Precompiling PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee]
WARNING: could not import Base.mimewritable into PyPlot
[ Info: Installing matplotlib via the Conda matplotlib package...
[ Info: Running `conda install -y matplotlib` in root environment
Solving environment: done
## Package Plan ##
environment location: /home/meng/.julia/packages/Conda/m7vem/deps/usr
added / updated specs:
- matplotlib
The following packages will be downloaded:
package | build
---------------------------|-----------------
pytz-2018.5 | py36_0 232 KB
pcre-8.42 | h439df22_0 251 KB
pyqt-5.9.2 | py36h22d08a2_0 5.9 MB
sip-4.19.8 | py36hf484d3e_0 290 KB
gst-plugins-base-1.14.0 | hbbd80ab_1 6.3 MB
python-dateutil-2.7.3 | py36_0 260 KB
gstreamer-1.14.0 | hb453b48_1 3.8 MB
expat-2.2.5 | he0dffb1_0 186 KB
fontconfig-2.13.0 | h9420a91_0 291 KB
qt-5.9.6 | h52aff34_0 86.7 MB
libxcb-1.13 | h1bed415_1 502 KB
tornado-5.1 | py36h14c3975_0 666 KB
jpeg-9b | h024ee3a_2 248 KB
libuuid-1.0.3 | h1bed415_2 16 KB
pyparsing-2.2.0 | py36_1 96 KB
kiwisolver-1.0.1 | py36hf484d3e_0 83 KB
cycler-0.10.0 | py36_0 13 KB
icu-58.2 | h9c2bf20_1 22.5 MB
libpng-1.6.34 | hb9fc6fc_0 334 KB
matplotlib-2.2.3 | py36hb69df0a_0 6.6 MB
dbus-1.13.2 | h714fa37_1 554 KB
libxml2-2.9.8 | h26e45fe_1 2.0 MB
freetype-2.9.1 | h8a8886c_0 821 KB
glib-2.56.1 | h000015b_0 5.0 MB
------------------------------------------------------------
Total: 143.5 MB
The following NEW packages will be INSTALLED:
cycler: 0.10.0-py36_0
dbus: 1.13.2-h714fa37_1
expat: 2.2.5-he0dffb1_0
fontconfig: 2.13.0-h9420a91_0
freetype: 2.9.1-h8a8886c_0
glib: 2.56.1-h000015b_0
gst-plugins-base: 1.14.0-hbbd80ab_1
gstreamer: 1.14.0-hb453b48_1
icu: 58.2-h9c2bf20_1
jpeg: 9b-h024ee3a_2
kiwisolver: 1.0.1-py36hf484d3e_0
libpng: 1.6.34-hb9fc6fc_0
libuuid: 1.0.3-h1bed415_2
libxcb: 1.13-h1bed415_1
libxml2: 2.9.8-h26e45fe_1
matplotlib: 2.2.3-py36hb69df0a_0
pcre: 8.42-h439df22_0
pyparsing: 2.2.0-py36_1
pyqt: 5.9.2-py36h22d08a2_0
python-dateutil: 2.7.3-py36_0
pytz: 2018.5-py36_0
qt: 5.9.6-h52aff34_0
sip: 4.19.8-py36hf484d3e_0
tornado: 5.1-py36h14c3975_0
Downloading and Extracting Packages
pytz-2018.5 | 232 KB | ###################################################################### | 100%
pcre-8.42 | 251 KB | ###################################################################### | 100%
pyqt-5.9.2 | 5.9 MB | ###################################################################### | 100%
sip-4.19.8 | 290 KB | ###################################################################### | 100%
gst-plugins-base-1.1 | 6.3 MB | ###################################################################### | 100%
python-dateutil-2.7. | 260 KB | ###################################################################### | 100%
gstreamer-1.14.0 | 3.8 MB | ###################################################################### | 100%
expat-2.2.5 | 186 KB | ###################################################################### | 100%
fontconfig-2.13.0 | 291 KB | ###################################################################### | 100%
qt-5.9.6 | 86.7 MB | ###################################################################### | 100%
libxcb-1.13 | 502 KB | ###################################################################### | 100%
tornado-5.1 | 666 KB | ###################################################################### | 100%
jpeg-9b | 248 KB | ###################################################################### | 100%
libuuid-1.0.3 | 16 KB | ###################################################################### | 100%
pyparsing-2.2.0 | 96 KB | ###################################################################### | 100%
kiwisolver-1.0.1 | 83 KB | ###################################################################### | 100%
cycler-0.10.0 | 13 KB | ###################################################################### | 100%
icu-58.2 | 22.5 MB | ###################################################################### | 100%
libpng-1.6.34 | 334 KB | ###################################################################### | 100%
matplotlib-2.2.3 | 6.6 MB | ###################################################################### | 100%
dbus-1.13.2 | 554 KB | ###################################################################### | 100%
libxml2-2.9.8 | 2.0 MB | ###################################################################### | 100%
freetype-2.9.1 | 821 KB | ###################################################################### | 100%
glib-2.56.1 | 5.0 MB | ###################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
ERROR: ArgumentError: Package PyCall not found in current path:
- Run `Pkg.add("PyCall")` to install the PyCall package.
Stacktrace:
[1] require(::Module, ::Symbol) at ./loading.jl:817
[2] top-level scope at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:389
[3] eval at ./boot.jl:319 [inlined]
[4] _initialize_backend(::Plots.PyPlotBackend) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:388
[5] backend(::Plots.PyPlotBackend) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:196
[6] backend(::Symbol) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:209
[7] pyplot() at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:29
[8] top-level scope at none:0
At this point, I restarted Julia
Now things get weird. (Didn’t we just install these?)
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Plots; pyplot(); plot(Plots.fakedata(100,5))
ERROR: ArgumentError: Package PyCall not found in current path:
- Run `Pkg.add("PyCall")` to install the PyCall package.
Stacktrace:
[1] require(::Module, ::Symbol) at ./loading.jl:817
[2] top-level scope at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:389
[3] eval at ./boot.jl:319 [inlined]
[4] _initialize_backend(::Plots.PyPlotBackend) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:388
[5] backend(::Plots.PyPlotBackend) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:196
[6] backend(::Symbol) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:209
[7] pyplot() at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:29
[8] top-level scope at none:0
(v1.0) pkg> add PyCall
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[438e738f] + PyCall v1.18.0
Updating `~/.julia/environments/v1.0/Manifest.toml`
[no changes]
julia> using Plots; pyplot(); plot(Plots.fakedata(100,5))
ERROR: ArgumentError: Package LaTeXStrings not found in current path:
- Run `Pkg.add("LaTeXStrings")` to install the LaTeXStrings package.
Stacktrace:
[1] require(::Module, ::Symbol) at ./loading.jl:817
[2] top-level scope at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:390
[3] eval at ./boot.jl:319 [inlined]
[4] _initialize_backend(::Plots.PyPlotBackend) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:388
[5] backend(::Plots.PyPlotBackend) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:196
[6] backend(::Symbol) at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:209
[7] pyplot() at /home/meng/.julia/packages/Plots/LWBTU/src/backends.jl:29
[8] top-level scope at none:0
(v1.0) pkg> add PyPlot
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[no changes]
Updating `~/.julia/environments/v1.0/Manifest.toml`
[no changes]
(v1.0) pkg> add LaTeXStrings
Resolving package versions...
Updating `~/.julia/environments/v1.0/Project.toml`
[b964fa9f] + LaTeXStrings v1.0.2
Updating `~/.julia/environments/v1.0/Manifest.toml`
[no changes]
julia> using Plots; pyplot(); plot(Plots.fakedata(100,5))
And then it worked!!
Next, install Atom.
This failed due to a few things with gconf2, ugh. Whatever.
uber-juno found the wrong Julia, but that’s expected, because I didn’t realize an old Julia was installed on this machine
It did install the new packages Juno.jl
, that was good!
Note that the Julia logo looks wrong in the Juno editor. The white underscores are missing. Didn’t record a screenshot, but I assume people have seen this.
julia> using Plots; pyplot(); plot(Plots.fakedata(100,5))
This showed a picture in the plotpane, great!
If you turn off the plotpane, then
julia> using Plots; pyplot(); plot(Plots.fakedata(100,5))
shows a plot if you execute it from the REPL-console.
However, if you try and Ctrl-Enter or Alt-Enter to run it from the editor, (after selecting Julia as the file type), then it doesn’t show.
If you want to get the plot to show, you need to add gui()
julia> using Plots; pyplot(); plot(Plots.fakedata(100,5)); gui()
There are known bugs with GR without the plotpane, so I’m not going to get into those. (see another thread in julia-users).
All in all, some room for improvement, but I got it working with a minimal amount of fuss! I hope these notes are helpful to others. I hope these notes are outdated rapidly! I’m going to try Windows and MacOSX over the next few days, so I’ll post any relevant notes here to.