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

Could not load library "libGR.dll" #1720

Closed
orswan opened this issue Sep 5, 2018 · 23 comments
Closed

Could not load library "libGR.dll" #1720

orswan opened this issue Sep 5, 2018 · 23 comments
Assignees

Comments

@orswan
Copy link

orswan commented Sep 5, 2018

Something has broken in GR:

julia> using Plots

julia> plot([1:10;])
ERROR: error compiling _plot!: error compiling _display: could not load library "libGR.dll"
The specified module could not be found.

Stacktrace:
 [1] #plot#132(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Array{Int64,1})
 at C:\Users\swan\.julia\packages\Plots\MnXMC\src\plot.jl:57
 [2] plot(::Array{Int64,1}) at C:\Users\swan\.julia\packages\Plots\MnXMC\src\plot.jl:51
 [3] top-level scope at none:0

julia>

I've successfully used GR recently, but something apparently broke when I tried to install Plotly. The installation of Plotly failed, and now I can't use GR either. Any tips on fixing this problem?

@jheinen
Copy link
Member

jheinen commented Sep 5, 2018

Please try:

ENV["GRDIR"]=""
Pkg.build("GR")

@swiesend
Copy link

swiesend commented Sep 5, 2018

Had the same problem under linux:

julia> plot(rand(100))
ERROR: error compiling _plot!: error compiling _display: could not load library "libGR.so"
libGR.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden
Stacktrace:
 [1] #plot#136(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Array{Float64,1}) at /home/sebastian/.julia/packages/Plots/ex9On/src/plot.jl:57
 [2] plot(::Array{Float64,1}) at /home/sebastian/.julia/packages/Plots/ex9On/src/plot.jl:51
 [3] top-level scope at none:0

Building the GR package again helped (here in the pkg console - type ] in julia>):

(v0.7) pkg> build GR
  Building GR → `~/.julia/packages/GR/ztzRc/deps/build.log`

Loading Plots.jl again sets the environment variable...

julia> using Plots

julia> ENV["GRDIR"]
"/home/sebastian/.julia/packages/GR/ztzRc/src/../deps/gr"

@jheinen
Copy link
Member

jheinen commented Sep 6, 2018

@orswan : Did the package build solve the problem?

@orswan
Copy link
Author

orswan commented Sep 6, 2018

Actually, before you suggested it, I just did a total reinstall of Julia, including deleting ~/.julia. So I'm afraid I don't know whether your solution would have worked. Sorry!

@orswan orswan closed this as completed Sep 6, 2018
@daniepf
Copy link

daniepf commented Sep 6, 2018

@jheinen
I had the same problem which has been solved by your fix, thanks.

julia> versioninfo()
Julia Version 1.1.0-DEV.196
Commit 8d993569b* (2018-09-05 10:09 UTC)
Platform Info:
OS: Linux (x86_64-redhat-linux)
CPU: Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, haswell)

@metanoid
Copy link

Please try:

ENV["GRDIR"]=""
Pkg.build("GR")

This worked for me on Windows. Had to restart julia to get the re-build to take effect, but it works.

@tallakt
Copy link

tallakt commented Jan 23, 2019

FWIW rebuilding worked for me in OSX

@JeffFessler
Copy link
Contributor

On Mac OSX 10.11.6 with Plots v0.24.0 and Julia 1.1.0 I just got the error

ERROR: error compiling _plot!: error compiling _display: could not load library "libGR.so"
dlopen(libGR.so.dylib, 1): image not found

and ]build GR solved it for me too.

@jasonsychau
Copy link

jasonsychau commented Jul 31, 2019

My Plots package was working, but it was suddenly not. I started using Plots with a pyplot backend, so I tried using the pyplot backend (pyplot() after using Plots) then restarted my notebook without pyplot to fix the problem.

@jbseby
Copy link

jbseby commented Aug 4, 2019

I have the same problem when using Plots.
I tried the same solution proposed by jheinen and metanoid, i.e.

ENV["GRDIR"]=""
Pkg.build("GR")

but I receive the following message error:

Updating registry at C:\Users\Jean-Baptiste SEBY\.julia\registries\General
Updating git-repo https://github.com/JuliaRegistries/General.git
GitError(Code:ERROR, Class:Odb, invalid pack file - invalid packfile type in header)

Stacktrace:
[1] macro expansion at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\LibGit2\src\error.jl:101 [inlined]
[2] LibGit2.GitObject(::LibGit2.GitRepo, ::String) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\LibGit2\src\repository.jl:142
[3] get_object_branch(::LibGit2.GitRepo, ::String, ::LibGit2.CachedCredentials) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\Types.jl:873
[4] get_object_branch(::LibGit2.GitRepo, ::Base.SHA1, ::LibGit2.CachedCredentials) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\Types.jl:859
[5] #handle_repos_add!#61(::Bool, ::Nothing, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\Types.jl:754
[6] #handle_repos_add! at .\dict.jl:0 [inlined]
[7] #instantiate#65(::Nothing, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:466
[8] instantiate at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:437 [inlined]
[9] #build#59(::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:372
[10] build at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:352 [inlined]
[11] #build#58 at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:350 [inlined]
[12] build at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:350 [inlined]
[13] #build#55 at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:347 [inlined]
[14] build(::String) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:347
[15] top-level scope at In[34]:2

@jheinen
Copy link
Member

jheinen commented Aug 5, 2019

Please try to ] update and/or remove anything under ENV["GRDIR"] and joinpath(ENV["GRDIR"], "../downloads") and restart julia.

@jbseby
Copy link

jbseby commented Aug 7, 2019

Yes, it works! Thank you very much, that's really helpful.

@ShuhuaGao
Copy link

@jheinen

Please try:

ENV["GRDIR"]=""
Pkg.build("GR")

Solved the issue on Windows 10.

julia> versioninfo()
Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)

Thank you!

@hafez-ahmad
Copy link

plot(rand(100))
Error showing value of type Plots.Plot{Plots.GRBackend}:
ERROR: could not load library "libGR.dll"
%1 is not a valid Win32 application.
Stacktrace:
[1] setcharheight(::Float64) at C:\Users\hafez.julia\packages\GR\8mv9N\src\GR.jl:1395
[2] gr_set_font(::Plots.Font, ::Plots.Subplot{Plots.GRBackend}; halign::Symbol, valign::Symbol, color::RGB{FixedPointNumbers.Normed{UInt8,8}}, rotation::Int64) at C:\Users\hafez.julia\packages\Plots\ViMfq\src\backends\gr.jl:386
[3] gr_set_xticks_font(::Plots.Subplot{Plots.GRBackend}) at C:\Users\hafez.julia\packages\Plots\ViMfq\src\backends\gr.jl:688
[4] _update_min_padding!(::Plots.Subplot{Plots.GRBackend}) at C:\Users\hafez.julia\packages\Plots\ViMfq\src\backends\gr.jl:900
[5] iterate at .\generator.jl:47 [inlined]
[6] _collect(::Array{AbstractLayout,2}, ::Base.Generator{Array{AbstractLayout,2},typeof(Plots._update_min_padding!)}, ::Base.EltypeUnknown, ::Base.HasShape{2}) at .\array.jl:699
[7] collect_similar(::Array{AbstractLayout,2}, ::Base.Generator{Array{AbstractLayout,2},typeof(Plots._update_min_padding!)}) at .\array.jl:628
[8] map(::Function, ::Array{AbstractLayout,2}) at .\abstractarray.jl:2162
[9] _update_min_padding!(::Plots.GridLayout) at C:\Users\hafez.julia\packages\Plots\ViMfq\src\layouts.jl:310
[10] prepare_output(::Plots.Plot{Plots.GRBackend}) at C:\Users\hafez.julia\packages\Plots\ViMfq\src\plot.jl:184
[11] display(::Plots.PlotsDisplay, ::Plots.Plot{Plots.GRBackend}) at C:\Users\hafez.julia\packages\Plots\ViMfq\src\output.jl:149
[12] display(::Any) at .\multimedia.jl:328
[13] #invokelatest#1 at .\essentials.jl:710 [inlined]
[14] invokelatest at .\essentials.jl:709 [inlined]
[15] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\REPL\src\REPL.jl:238
[16] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\REPL\src\REPL.jl:223
[17] (::REPL.var"#do_respond#54"{Bool,Bool,REPL.var"#64#73"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\REPL\src\REPL.jl:822
[18] #invokelatest#1 at .\essentials.jl:710 [inlined]
[19] invokelatest at .\essentials.jl:709 [inlined]
[20] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\REPL\src\LineEdit.jl:2355
[21] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\REPL\src\REPL.jl:1143
[22] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at .\task.jl:356

I tried
ENV["GRDIR"]=""
Pkg.build("GR") , this did not solve my problem.
Julia 1.5, I have Tried with Julia 1.4 and 1.5. same problem.

@jheinen
Copy link
Member

jheinen commented Aug 11, 2020

Did you ] up GR before building it?

@hafez-ahmad
Copy link

I tried to build, but it is taking forever.I used GR backend plot with earlier version . But don’t what's going on my laptop.today I deleted completely then reinstalled julia 1.5 then it worked fine.

@Renmusxd
Copy link

Renmusxd commented Oct 12, 2023

Hi, I ran into this issue myself with a fresh julia 1.9.3 install on a new macOS 13.4 system.
After add Plots worked, attempting to run plot(1:10) left me with a could not load library libGR.so.

The environment variable pointed to a directory ~/.julia/packages/GR/BwGt2/src/../deps/gr/lib which contained libGR.dylib. Simply symlinking ln -s libGR.dylib libGR.so.dylib solved the problem, but this is obviously a hack. Is there a better option?

@jheinen
Copy link
Member

jheinen commented Oct 13, 2023

Was there an old GR installation? Did you ] up GR (or better all packages)?

@Renmusxd
Copy link

Renmusxd commented Oct 13, 2023

This was completely fresh - this is my first time using Julia so nothing Julia related was on the computer until installed Julia, then added ITensors and Plots.

In case ITensors was the issue I removed it, and installed Plots by itself with the same result.

@jheinen
Copy link
Member

jheinen commented Oct 13, 2023

Could you please try to install GR v0.72.10 in an empty environment and start julia with JULIA_DEBUG=GR? I have absolutely no idea what causes the problem(s).

  1. rename or remove ~/.julia
  2. JULIA_DEBUG=GR julia
  3. ] add GR
  4. surface(peaks())

@Renmusxd
Copy link

Thanks, I deleted .julia as well as all the julia related files from my system, then reinstalled everything from scratch. I've been so far unable to recreate the bug. The first iteration must have been misconfigured somehow, or else I missed something. Sorry about the false alarm, and thanks for this project!

@Doublonmousse
Copy link

I have the same issue, similar hardware (on mac os 14 and apple silicon) and it happens almost everytime I create a new project env and reinstall plots in the new local environment. May try to reinstall from scratch as well.

It manages to build but still will refuse to work. The build log has some warnings though :

[ Info: Found existing GR run-time in /Users/USER/.julia/packages/GR/cRdXQ/src/../deps/gr
┌ Warning: Assignment to `grdir` in soft scope is ambiguous because a global variable by the same name exists: `grdir` will be treated as a new local. Disambiguate by using `local grdir` to suppress this warning or `global grdir` to assign to the existing global variable.
└ @ ~/.julia/packages/GR/cRdXQ/deps/build.jl:164

@jheinen
Copy link
Member

jheinen commented Nov 5, 2023

Unfortunately, I cannot reproduce the problem. Could you briefly describe in a minimal example/workflow how the problem arises for you.

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

No branches or pull requests