huckl3b3rry87 / PrettyPlots.jl

Other
1 stars 2 forks source link

updating matlib plot version #4

Open huckl3b3rry87 opened 5 years ago

huckl3b3rry87 commented 5 years ago

Pyplot.jl is a backend for PrettyPlots.jl and it requires a newer version of matplotlib or this error can pop up

ERROR: PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw)) <type 'exceptions.IndexError'>
IndexError('list index out of range',)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 601, in gcf
    return figure()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 548, in figure
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/_backend_tk.py", line 1044, in new_figure_manager_given_figure
    window = Tk.Tk(className="matplotlib")
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1813, in __init__
    baseName = os.path.basename(sys.argv[0])

Stacktrace:
 [1] pyerr_check at /home/febbo/.julia/v0.6/PyCall/src/exception.jl:60 [inlined]
 [2] pyerr_check at /home/febbo/.julia/v0.6/PyCall/src/exception.jl:64 [inlined]
 [3] macro expansion at /home/febbo/.julia/v0.6/PyCall/src/exception.jl:84 [inlined]
 [4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::Ptr{Void}) at /home/febbo/.julia/v0.6/PyCall/src/pyfncall.jl:44
 [5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{}, ::Int64, ::Ptr{Void}) at /home/febbo/.julia/v0.6/PyCall/src/pyfncall.jl:29
 [6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{}, ::Array{Any,1}) at /home/febbo/.julia/v0.6/PyCall/src/pyfncall.jl:11
 [7] gcf() at /home/febbo/.julia/v0.6/PyPlot/src/PyPlot.jl:156
 [8] _create_backend_figure(::Plots.Plot{Plots.PyPlotBackend}) at /home/febbo/.julia/v0.6/Plots/src/backends/pyplot.jl:409
 [9] _plot_setup(::Plots.Plot{Plots.PyPlotBackend}, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}) at /home/febbo/.julia/v0.6/Plots/src/pipeline.jl:213
 [10] _plot!(::Plots.Plot{Plots.PyPlotBackend}, ::Dict{Symbol,Any}, ::Tuple{Int64}) at /home/febbo/.julia/v0.6/Plots/src/plot.jl:206
 [11] (::RecipesBase.#kw##plot)(::Array{Any,1}, ::RecipesBase.#plot, ::Int64) at ./<missing>:0
 [12] #statePlot#9(::Array{Any,1}, ::Function, ::NLOptControl.NLOpt, ::Int64, ::Int64) at /home/febbo/.julia/v0.6/PrettyPlots/src/NLOptControl_plots.jl:66
 [13] collect(::Base.Generator{UnitRange{Int64},PrettyPlots.##54#57{NLOptControl.NLOpt,Int64,Tuple{}}}) at ./array.jl:475
 [14] mpcPlot(::NLOptControl.NLOpt, ::Int64) at /home/febbo/.julia/v0.6/PrettyPlots/src/MPCPlots.jl:9
 [15] macro expansion at ./REPL[129]:2 [inlined]
 [16] macro expansion at /home/febbo/.julia/v0.6/Plots/src/animation.jl:155 [inlined]
 [17] anonymous at ./<missing>:?

First attempt to fix did not work, which was

ENV["PYTHON"]=""
Pkg.build("PyCall")
huckl3b3rry87 commented 5 years ago

Also in the terminal type

conda install matplotlib

Instructions installing conda

huckl3b3rry87 commented 5 years ago

if conda downgrades matplotlib

conda install matplotlib=2.2.3
huckl3b3rry87 commented 5 years ago

Given that we are using conda now, try building PyCall with it as

ENV["PYTHON"]= "/home/febbo/miniconda2/bin/"
"/home/febbo/miniconda2/bin/"
julia> Pkg.build("PyCall")
huckl3b3rry87 commented 5 years ago

These python path issues need to be considered together https://github.com/JuliaMPC/MichiganAutonomousVehicles.jl/issues/8