From c250d7c073ac1c057e299f46f402a65f84be93ea Mon Sep 17 00:00:00 2001 From: Huckleberry Febbo Date: Thu, 19 Jan 2017 14:45:16 -0500 Subject: [PATCH 1/3] working on fixing pyplot issue for ubuntu --- src/backends/pyplot.jl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 84ea6718..36d0d5f5 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -56,6 +56,34 @@ function add_backend_string(::PyPlotBackend) Pkg.build("PyPlot") end """ + if !Plots.is_installed("PyPlot") + Pkg.add("PyPlot") + end + withenv("PYTHON" => "") do + Pkg.build("PyPlot") + end + import Conda # TODO since this only known to occur on Ubuntu we could also check the user's OS here + Conda.add("qt=4.8.5") # run the old version of Conda + # TO AVOID: + # 1) Segfault when attempting to run pylplot + # caused by Conda update to Segfault with qt >=4.8.6 on Ubuntu https://github.com/JuliaPy/PyPlot.jl/issues/234 + # 2) precomilation issue after updating Plots.jl + #= + INFO: Recompiling stale cache file /home/febbo/.julia/lib/v0.5/Plots.ji for module Plots. + ERROR: LoadError: Declaring __precompile__(false) is not allowed in files that are being precompiled. + in __precompile__(::Bool) at ./loading.jl:300 + in include_from_node1(::String) at ./loading.jl:488 + in macro expansion; at ./none:2 [inlined] + in anonymous at ./:? + in eval(::Module, ::Any) at ./boot.jl:234 + in process_options(::Base.JLOptions) at ./client.jl:239 + in _start() at ./client.jl:318 + while loading /home/febbo/.julia/v0.5/Plots/src/Plots.jl, in expression starting on line 1 + ERROR: LoadError: Failed to precompile Plots to /home/febbo/.julia/lib/v0.5/Plots.ji. + in compilecache(::String) at ./loading.jl:593 + in require(::Symbol) at ./loading.jl:393 + in include_from_node1(::String) at ./loading.jl:488 + =# end function _initialize_backend(::PyPlotBackend) From cd8939fe0bd69a64f5b9d5d3dd85324304b4c3f3 Mon Sep 17 00:00:00 2001 From: Huckleberry Febbo Date: Thu, 19 Jan 2017 17:32:37 -0500 Subject: [PATCH 2/3] finished fixing segfault issue when qt>v4.8.5 on Ubuntu using pyplot --- src/backends/pyplot.jl | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 36d0d5f5..64ae74bd 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -56,34 +56,6 @@ function add_backend_string(::PyPlotBackend) Pkg.build("PyPlot") end """ - if !Plots.is_installed("PyPlot") - Pkg.add("PyPlot") - end - withenv("PYTHON" => "") do - Pkg.build("PyPlot") - end - import Conda # TODO since this only known to occur on Ubuntu we could also check the user's OS here - Conda.add("qt=4.8.5") # run the old version of Conda - # TO AVOID: - # 1) Segfault when attempting to run pylplot - # caused by Conda update to Segfault with qt >=4.8.6 on Ubuntu https://github.com/JuliaPy/PyPlot.jl/issues/234 - # 2) precomilation issue after updating Plots.jl - #= - INFO: Recompiling stale cache file /home/febbo/.julia/lib/v0.5/Plots.ji for module Plots. - ERROR: LoadError: Declaring __precompile__(false) is not allowed in files that are being precompiled. - in __precompile__(::Bool) at ./loading.jl:300 - in include_from_node1(::String) at ./loading.jl:488 - in macro expansion; at ./none:2 [inlined] - in anonymous at ./:? - in eval(::Module, ::Any) at ./boot.jl:234 - in process_options(::Base.JLOptions) at ./client.jl:239 - in _start() at ./client.jl:318 - while loading /home/febbo/.julia/v0.5/Plots/src/Plots.jl, in expression starting on line 1 - ERROR: LoadError: Failed to precompile Plots to /home/febbo/.julia/lib/v0.5/Plots.ji. - in compilecache(::String) at ./loading.jl:593 - in require(::Symbol) at ./loading.jl:393 - in include_from_node1(::String) at ./loading.jl:488 - =# end function _initialize_backend(::PyPlotBackend) @@ -109,7 +81,18 @@ function _initialize_backend(::PyPlotBackend) const pycollections = PyPlot.pywrap(PyPlot.pyimport("matplotlib.collections")) const pyart3d = PyPlot.pywrap(PyPlot.pyimport("mpl_toolkits.mplot3d.art3d")) end - + if is_linux() + @eval begin + # avoid Conda update that causes Segfault with qt >=4.8.6 on Ubuntu https://github.com/JuliaPy/PyPlot.jl/issues/234 + import Conda + kw = Conda._installed_packages_dict() + if (!haskey(kw,"qt") || (qt_version=get(kw,"qt",0)[1]!=v"4.8.5")) + print("\n Switching to qt v4.8.5!! \n") + Conda.add("qt=4.8.5") + error("\n Please RESTART julia to use qt v4.8.5!! \n If we did not error here, a Segmentation fault error would occur. \n \n") + end + end + end # we don't want every command to update the figure PyPlot.ioff() end From 43a213643bdb268050fbdaf4dcaf5e12b2f84eaa Mon Sep 17 00:00:00 2001 From: Huckleberry Febbo Date: Thu, 19 Jan 2017 18:04:09 -0500 Subject: [PATCH 3/3] changed code so it does not automatically change qt version --- src/backends/pyplot.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 64ae74bd..c02a512f 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -55,6 +55,10 @@ function add_backend_string(::PyPlotBackend) withenv("PYTHON" => "") do Pkg.build("PyPlot") end + import Conda + Conda.add("qt=4.8.5") + + # now restart julia! """ end @@ -87,9 +91,8 @@ function _initialize_backend(::PyPlotBackend) import Conda kw = Conda._installed_packages_dict() if (!haskey(kw,"qt") || (qt_version=get(kw,"qt",0)[1]!=v"4.8.5")) - print("\n Switching to qt v4.8.5!! \n") - Conda.add("qt=4.8.5") - error("\n Please RESTART julia to use qt v4.8.5!! \n If we did not error here, a Segmentation fault error would occur. \n \n") + print("\n If the code has a Segmentation fault error switch to qt v4.8.5 by pasting the following code into julia: \n \n") + add_backend_string(backend()) end end end