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] Can't load PyPlot and Plots in the same environment #2685

Closed
zhangyinhan opened this issue May 7, 2020 · 20 comments
Closed

[BUG] Can't load PyPlot and Plots in the same environment #2685

zhangyinhan opened this issue May 7, 2020 · 20 comments
Labels

Comments

@zhangyinhan
Copy link

Please search existing issues to avoid duplicates.

Details

julia> using PyPlot

julia> using Plots
ERROR: InitError: could not load library "/Users/finalboss/.julia/artifacts/a6d3ce86d902a885e1e092882cb0ddb718aade03/lib/libass.9.dylib"
dlopen(/Users/finalboss/.julia/artifacts/a6d3ce86d902a885e1e092882cb0ddb718aade03/lib/libass.9.dylib, 1): Library not loaded: @rpath/libfreetype.6.dylib
  Referenced from: /Users/finalboss/.julia/artifacts/a6d3ce86d902a885e1e092882cb0ddb718aade03/lib/libass.9.dylib
  Reason: Incompatible library version: libass.9.dylib requires version 24.0.0 or later, but libfreetype.6.dylib provides version 23.0.0
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /Applications/Julia-1.4.app/Contents/Resources/julia/lib/julia/sys.dylib:?
 [2] dlopen(::String) at /Applications/Julia-1.4.app/Contents/Resources/julia/lib/julia/sys.dylib:?
 [3] __init__() at /Users/finalboss/.julia/packages/libass_jll/Ty9Kb/src/wrappers/x86_64-apple-darwin14.jl:46
 [4] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [5] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:781
 [6] _tryrequire_from_serialized(::Base.PkgId, ::UInt64, ::String) at ./loading.jl:712
 [7] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:770
 [8] _tryrequire_from_serialized(::Base.PkgId, ::UInt64, ::String) at ./loading.jl:712
 [9] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:770
 [10] _require(::Base.PkgId) at ./loading.jl:1006
 [11] require(::Base.PkgId) at ./loading.jl:927
 [12] require(::Module, ::Symbol) at ./loading.jl:922
during initialization of module libass_jll

julia> versioninfo()
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)

Backends

This bug occurs on ( insert x below )

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

Versions

Plots.jl version: Plots v1.2.2
Backend version: GR v0.48.0
Output of versioninfo():
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.7.0)
CPU: Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)

@zhangyinhan zhangyinhan added the bug label May 7, 2020
@BeastyBlacksmith BeastyBlacksmith changed the title [BUG] the incompatible with the PyPlot [BUG] Can't load PyPlot and Plots in the same environments May 7, 2020
@BeastyBlacksmith BeastyBlacksmith changed the title [BUG] Can't load PyPlot and Plots in the same environments [BUG] Can't load PyPlot and Plots in the same environment May 7, 2020
@BeastyBlacksmith
Copy link
Member

I can't reproduce this. Might updating of the artifact help?

@zhangyinhan
Copy link
Author

zhangyinhan commented May 11, 2020 via email

@BeastyBlacksmith
Copy link
Member

Yes, I tried on a Mac

@zhangyinhan
Copy link
Author

zhangyinhan commented May 11, 2020 via email

@BeastyBlacksmith
Copy link
Member

Seems I had an old libass after libass_jll v0.14.0+1 ⇒ v0.14.0+2, I can reproduce

@giordano
Copy link
Contributor

After you get this error, can you please do

using Libdl
filter!(lib -> occursin("freetype", lib), dllist())

and copy here the output?

@zhangyinhan
Copy link
Author

zhangyinhan commented May 11, 2020 via email

@giordano
Copy link
Contributor

In a shell (also in the shell mode in Julia REPL) please run the command

otool -L /Users/finalboss/.julia/conda/3/lib/libfreetype.6.dylib

I'm pretty sure this has version 23, because the other one has version 24:

# otool -L libfreetype.6.dylib 
libfreetype.6.dylib:
        @rpath/libfreetype.6.dylib (compatibility version 24.0.0, current version 24.1.0)
        @rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
        @rpath/libbz2.1.0.6.dylib (compatibility version 1.0.0, current version 1.0.6)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

@zhangyinhan
Copy link
Author

zhangyinhan commented May 11, 2020 via email

@giordano
Copy link
Contributor

No idea where that library is coming from, but that's the culprit 🙂

@giordano
Copy link
Contributor

Seems I had an old libass after libass_jll v0.14.0+1 ⇒ v0.14.0+2, I can reproduce

This is what I get with v0.14.0+1:

# otool -L libass-1.9.dylib 
libass-1.9.dylib:
        @rpath/libass.9.dylib (compatibility version 10.0.0, current version 10.2.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        @rpath/libfreetype.6.dylib (compatibility version 24.0.0, current version 24.1.0)
        @rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
        @rpath/libbz2.1.0.6.dylib (compatibility version 1.0.0, current version 1.0.6)
        @rpath/libfribidi.0.dylib (compatibility version 0.0.0, current version 0.0.0)
        /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1153.18.0)
        /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)

and this with v0.14.0+2:

# otool -L libass-2.9.dylib 
libass-2.9.dylib:
        @rpath/libass.9.dylib (compatibility version 10.0.0, current version 10.2.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        @rpath/libfreetype.6.dylib (compatibility version 24.0.0, current version 24.1.0)
        @rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
        @rpath/libbz2.1.0.6.dylib (compatibility version 1.0.0, current version 1.0.6)
        @rpath/libfribidi.0.dylib (compatibility version 0.0.0, current version 0.0.0)
        /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1153.18.0)
        /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)

Nothing changed in libass, just updating the package can't have changed anything for you.

@giordano
Copy link
Contributor

As a workaround can I suggest to load Plots.jl before PyPlot.jl?

@zhangyinhan
Copy link
Author

zhangyinhan commented May 13, 2020 via email

@VasylHafych
Copy link

I am experiencing the same problem as @zhangyinhan.


(@v1.4) pkg> status Plots
Status `~/.julia/environments/v1.4/Project.toml`
  [91a5bcdd] Plots v1.3.6

(@v1.4) pkg> status PyPlot
Status `~/.julia/environments/v1.4/Project.toml`
  [d330b81b] PyPlot v2.9.0

julia> versioninfo()
Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 8

Changing Plots.jl and PyPlot.jl order does not help. Is there any other workaround?

@zhangyinhan
Copy link
Author

zhangyinhan commented Jun 1, 2020 via email

@giordano
Copy link
Contributor

giordano commented Jun 1, 2020

Is there any other workaround?

Not that I'm aware of.

Out of curiosity, why do you need to load PyPlot and Plots together? Do you plan to use the two plotting libraries at the same time?

@zhangyinhan
Copy link
Author

zhangyinhan commented Jun 1, 2020 via email

@VasylHafych
Copy link

Out of curiosity, why do you need to load PyPlot and Plots together? Do you plan to use the two plotting libraries at the same time?

I am using PyPlot.jl for publication-quality plots and Plots.jl for making easy & simple animations :)

@zhangyinhan
Copy link
Author

zhangyinhan commented Jun 1, 2020 via email

@IanButterworth
Copy link
Contributor

IanButterworth commented Sep 26, 2020

I'd recommend just doing this kind of thing:

using Plots
pyplot() # this loads the `PyPlot` module
# run your code that uses pyplot, ether using the Plots API, or the PyPlot API via `PyPlot.xxx`


gr()
# run your code that uses the default Plots backend, which is GR

I believe you should be able to switch back and forth between the two without issue
More info on the backends here http://docs.juliaplots.org/latest/backends/

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

No branches or pull requests

6 participants