PyPlot fails on Mac

julia> import PyPlot

julia> PyPlot.plot(rand(4))
1-element Array{PyCall.PyObject,1}:
 PyObject <matplotlib.lines.Line2D object at 0x7ff970b12da0>

julia> PyPlot.savefig("a.png")
ERROR: PyError ($(Expr(:escape, :(ccall(#= /Users/monty/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'ImportError'>
ImportError('dlopen(/Users/monty/.julia/conda/3/lib/python3.6/site-packages/matplotlib/_png.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libpng16.16.dylib\n  Referenced from: /Users/monty/.julia/conda/3/lib/python3.6/site-packages/matplotlib/_png.cpython-36m-darwin.so\n  Reason: Incompatible library version: _png.cpython-36m-darwin.so requires version 54.0.0 or later, but libpng16.16.37.0.dylib provides version 16.0.0',)
  File "/Users/monty/.julia/conda/3/lib/python3.6/site-packages/matplotlib/pyplot.py", line 723, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/Users/monty/.julia/conda/3/lib/python3.6/site-packages/matplotlib/figure.py", line 2203, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/Users/monty/.julia/conda/3/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 2105, in print_figure
    **kwargs)
  File "/Users/monty/.julia/conda/3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 505, in print_png
    from matplotlib import _png

Stacktrace:
 [1] pyerr_check at /Users/monty/.julia/packages/PyCall/zqDXB/src/exception.jl:60 [inlined]
 [2] pyerr_check at /Users/monty/.julia/packages/PyCall/zqDXB/src/exception.jl:64 [inlined]
 [3] _handle_error(::String) at /Users/monty/.julia/packages/PyCall/zqDXB/src/exception.jl:81
 [4] macro expansion at /Users/monty/.julia/packages/PyCall/zqDXB/src/exception.jl:95 [inlined]
 [5] #110 at /Users/monty/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 [inlined]
 [6] disable_sigint at ./c.jl:446 [inlined]
 [7] __pycall! at /Users/monty/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:42 [inlined]
 [8] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{String}, ::Int64, ::Ptr{Nothing}) at /Users/monty/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:29
 [9] _pycall! at /Users/monty/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:11 [inlined]
 [10] #pycall#116 at /Users/monty/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:83 [inlined]
 [11] pycall at /Users/monty/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:83 [inlined]
 [12] savefig(::String; kws::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/monty/.julia/packages/PyPlot/XHEG0/src/PyPlot.jl:177
 [13] savefig(::String) at /Users/monty/.julia/packages/PyPlot/XHEG0/src/PyPlot.jl:174
 [14] top-level scope at REPL[5]:1
 [15] eval(::Module, ::Any) at ./boot.jl:331
 [16] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
 [17] run_backend(::REPL.REPLBackend) at /Users/monty/.julia/packages/Revise/MgvIv/src/Revise.jl:1023
 [18] top-level scope at none:0
(@v1.4) pkg> status PyPlot
Status `~/.julia/environments/v1.4/Project.toml`
  [d330b81b] PyPlot v2.9.0

(@v1.4) pkg> status PyCall
Status `~/.julia/environments/v1.4/Project.toml`
  [438e738f] PyCall v1.91.4

(@v1.4) pkg> status Conda
Status `~/.julia/environments/v1.4/Project.toml`
  [8f4d0f93] Conda v1.4.1

Try doing Conda.update() to see if they’ve fixed this problem upstream.

tried Conda.update(). it did not help

Complete rebuild of Conda solved the issue.