Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] pyplot backend on macOS does not work after upgrading to Julia v1.6.0 #3416

Closed
BoundaryValueProblems opened this issue Apr 3, 2021 · 9 comments

Comments

@BoundaryValueProblems
Copy link
Contributor

Details

After upgrading Julia from v1.5.4 to v1.6.0, the pyplot backend on macOS does not work. On windows machines, I don't have any problem. First of all, I wiped out ~/.julia/conda; and then rebuilt it by ENV["PYTHON"]=""; Pkg.build("PyCall"). Then, at least, the package PyPlot.jl does work (using PyPlot installed all the relevant files, and the examples on the PyPlot.jl home page did work). However, when I ran using Plots; pyplot(), it generated the following error:

INTEL MKL ERROR: dlopen(/Users/xxx/.julia/conda/3/lib/libmkl_intel_thread.dylib, 9): Library not loaded: @rpath/libiomp5.dylib
  Referenced from: /Users/xxx/.julia/conda/3/lib/libmkl_intel_thread.dylib
  Reason: image not found.
Intel MKL FATAL ERROR: Cannot load libmkl_intel_thread.dylib.

I found the following post https://discourse.julialang.org/t/intel-mkl-fatal-error-with-pyplot/36737/9 , which suggests

using Conda
Conda.rm("numpy")
Conda.add("numpy")

So, after I tried this, and ran using PyPlot, which installed matplotlib and some associated files again, and the PyPlot examples in the PyPlot.jl home page worked again. Finally, I ran using Plots; pyplot(). Then, I got the following message (looks like a warning message):

objc[51561]: Class RunLoopModeTracker is implemented in both /Users/xxx/.julia/artifacts/ee74d003b12e6dd5f748e8cefb1688edbdfb184b/lib/QtCore.framework/Versions/5/QtCore (0x158162aa8) and /Users/xxx/.julia/conda/3/lib/libQt5Core.5.dylib (0x178293a80). One of the two will be used. Which one is undefined.
┌ Warning: No working GUI backend found for matplotlib
└ @ PyPlot ~/.julia/packages/PyPlot/XHEG0/src/init.jl:165
Plots.PyPlotBackend()

And this was done on a simple Terminal session. So, after this I used Atom and VSCode to display simple things like plot(randn(100), and finally it worked (with the above warning message)!

So, it would be great if someone can fix this warning problem and explain to the users why pyplot() first had the MKL error while the genuine PyPlot did not have this error.

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default)
pyplot x
plotly
plotlyjs
pgfplotsx
inspectdr

Versions

Plots.jl version: v1.11.2
Backend version (]st -m): PyPlot v2.9.0; PyCall v1.92.2; Conda v1.5.1
Output of versioninfo():
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin19.6.0)
CPU: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =

@isentropic
Copy link
Member

This should belong to PyPlot repo I believe, Plots just assumes you got it working.

@isentropic
Copy link
Member

Feel free to reopen if you think otherwise

@BoundaryValueProblems
Copy link
Contributor Author

BoundaryValueProblems commented Apr 5, 2021

@isentropic ; This is definitely the pyplot backend of Plots.jl issue. Not the problem of the PyPlot.jl.
So I must reopen it. How can I reopen this without resubmitting the same post?

@isentropic isentropic reopened this Apr 5, 2021
@isentropic
Copy link
Member

I do not have a mac system so I can't comment on this

@isentropic
Copy link
Member

It is very hard to say why Plots is failing, perhaps the PyPlot version that Plots uses is different?

@isentropic
Copy link
Member

Perhaps you could tweak/modify Project.toml and see if pinning some of the PyPlot version might help you?

@stevengj
Copy link
Contributor

stevengj commented Apr 6, 2021

(Note that you might also try using Conda; Conda.update() in case your Conda packages are out of date.)

The RunLoopModeTracker sounds like a conflict between Conda's Qt libraries and Julia's (which you presumably loaded via some other package). Maybe try a different matplotlib backend by setting the MPLBACKEND environment variable.

@jdeldre
Copy link
Contributor

jdeldre commented Apr 7, 2021

I'm having exactly the same issue as @BoundaryValueProblems (on the same architecture).

With some experimentation, I've found that the key issue is not the Julia version but the changes in GR from v0.55.0 to v0.57.0 (a switch to providing the package via BinaryBuilder). By downgrading GR to v0.55.0, no warnings arise when using Plots; pyplot() is issued.

It's too bad the backends interfere like this.

@BoundaryValueProblems
Copy link
Contributor Author

With Julia 1.7.x, I don't have any problems with the pyplot backend except that on my iMac, there are two Qt5Core libraries are installed in two different folders, which generates the following warning:

julia> using Plots; pyplot(dpi=200,size=(800,600))
objc[1209]: Class QMacAutoReleasePoolTracker is implemented in both /Users/xxx/.julia/artifacts/a0db4e704fd0da4298744f012883535d351fa170/lib/QtCore.framework/Versions/5/QtCore (0x119d73918) and /Users/xxx/.julia/conda/3/lib/libQt5Core.5.12.9.dylib (0x160328528). One of the two will be used. Which one is undefined.
objc[1209]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Users/xxx/.julia/artifacts/a0db4e704fd0da4298744f012883535d351fa170/lib/QtCore.framework/Versions/5/QtCore (0x119d73990) and /Users/xxx/.julia/conda/3/lib/libQt5Core.5.12.9.dylib (0x1603285a0). One of the two will be used. Which one is undefined.
objc[1209]: Class KeyValueObserver is implemented in both /Users/xxx/.julia/artifacts/a0db4e704fd0da4298744f012883535d351fa170/lib/QtCore.framework/Versions/5/QtCore (0x119d739b8) and /Users/xxx/.julia/conda/3/lib/libQt5Core.5.12.9.dylib (0x1603285c8). One of the two will be used. Which one is undefined.
objc[1209]: Class RunLoopModeTracker is implemented in both /Users/xxx/.julia/artifacts/a0db4e704fd0da4298744f012883535d351fa170/lib/QtCore.framework/Versions/5/QtCore (0x119d73a08) and /Users/xxx/.julia/conda/3/lib/libQt5Core.5.12.9.dylib (0x160328618). One of the two will be used. Which one is undefined.
Plots.PyPlotBackend()

Although I do not want to see this kind of warning messages, the pyplot backend is currently working. So, I'll close this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants