# GTK and "libgtk-3"

**URL:** https://discourse.julialang.org/t/gtk-and-libgtk-3/27699
**Category:** New to Julia
**Tags:** package, vscode
**Created:** [August 19, 2019, 6:43am UTC](https://discourse.julialang.org/t/gtk-and-libgtk-3/27699 "2019-08-19T06:43:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jar](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jar](https://discourse.julialang.org/u/jar)
#### Post date: [August 19, 2019, 6:43am UTC](https://discourse.julialang.org/t/gtk-and-libgtk-3/27699/1 "2019-08-19T06:43:52Z")

</div>

I try to see an image from vscode, but it doesn’t work, from REPL everything well, but Code doesn’t work:  
using Plots, FileIO, ImageView  
img = load(“/Users/jar/src/julia/lena\_color\_512.tif”)  
plot(img)

The error is this:  
[Info: Precompiling ImageView [86fae568-95e7-573e-a6b2-d8a6b900c9ef]  
**ERROR: LoadError: error compiling top-level scope: could not load library “libgtk-3”**  
dlopen(libgtk-3.dylib, 1): image not found  
Stacktrace:  
[1] include at ./boot.jl:326 [inlined]  
[2] include\_relative(::Module, ::String) at ./loading.jl:1038  
[3] include(::Module, ::String) at ./sysimg.jl:29  
[4] top-level scope at none:2  
[5] eval at ./boot.jl:328 [inlined]  
[6] eval(::Expr) at ./client.jl:404  
[7] top-level scope at ./none:3  
in expression starting at /Users/jar/.julia/packages/Gtk/aP55V/src/Gtk.jl:44  
ERROR: LoadError: Failed to precompile Gtk [4c0ca9eb-093a-5379-98c5-f87ac0bbbf44] to /Users/jar/.julia/compiled/v1.1/Gtk/Vjnq0.ji.  
Stacktrace:  
[1] error(::String) at ./error.jl:33  
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1197  
[3] \_require(::Base.PkgId) at ./loading.jl:960  
[4] require(::Base.PkgId) at ./loading.jl:858  
[5] require(::Module, ::Symbol) at ./loading.jl:853  
[6] include at ./boot.jl:326 [inlined]  
[7] include\_relative(::Module, ::String) at ./loading.jl:1038  
[8] include(::Module, ::String) at ./sysimg.jl:29  
[9] top-level scope at none:2  
[10] eval at ./boot.jl:328 [inlined]  
[11] eval(::Expr) at ./client.jl:404  
[12] top-level scope at ./none:3  
in expression starting at /Users/jar/.julia/packages/ImageView/1uiRS/src/ImageView.jl:5  
ERROR: LoadError: Failed to precompile ImageView [86fae568-95e7-573e-a6b2-d8a6b900c9ef] to /Users/jar/.julia/compiled/v1.1/ImageView/4mtgY.ji.  
Stacktrace:  
[1] error(::String) at ./error.jl:33  
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1197  
[3] \_require(::Base.PkgId) at ./loading.jl:960  
[4] require(::Base.PkgId) at ./loading.jl:858  
[5] require(::Module, ::Symbol) at ./loading.jl:853  
[6] include\_string(::Module, ::String, ::String) at ./loading.jl:1008  
[7] (::getfield(Main.\_vscodeserver, Symbol(“##9#12”)){String,Int64,Int64,String})() at /Users/jar/.vscode/extensions/julialang.language-julia-0.12.1/scripts/terminalserver/terminalserver.jl:153  
[8] withpath(::getfield(Main.\_vscodeserver, Symbol(“##9#12”)){String,Int64,Int64,String}, ::String) at /Users/jar/.vscode/extensions/julialang.language-julia-0.12.1/scripts/terminalserver/repl.jl:62  
[9] (::getfield(Main.\_vscodeserver, Symbol(“##8#11”)){String,Int64,Int64,String})() at /Users/jar/.vscode/extensions/julialang.language-julia-0.12.1/scripts/terminalserver/terminalserver.jl:152  
[10] hideprompt(::getfield(Main.\_vscodeserver, Symbol(“##8#11”)){String,Int64,Int64,String}) at /Users/jar/.vscode/extensions/julialang.language-julia-0.12.1/scripts/terminalserver/repl.jl:28  
[11] macro expansion at /Users/jar/.vscode/extensions/julialang.language-julia-0.12.1/scripts/terminalserver/terminalserver.jl:148 [inlined]  
[12] (::getfield(Main.\_vscodeserver, Symbol(“##7#10”)))() at ./task.jl:259  
in expression starting at /Users/jar/src/julia/testImages.jl:1

I check Gtk and it’s OK:  
**(v1.1) pkg\>** add Gtk  
**Updating** registry at `~/.julia/registries/General`  
**Updating** git-repo `https://github.com/JuliaRegistries/General.git`  
**Resolving** package versions…  
**Updating** `~/.julia/environments/v1.1/Project.toml`  
[no changes]  
**Updating** `~/.julia/environments/v1.1/Manifest.toml`  
[no changes]

How I can load “libgtk-3”?

---

<div class="post-metadata">

### Author: ![Iulian.Cioarca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iulian.cioarca/32/30166_2.png) [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)
#### Post date: [August 19, 2019, 7:31am UTC](https://discourse.julialang.org/t/gtk-and-libgtk-3/27699/2 "2019-08-19T07:31:40Z")

</div>

Can you check if libgtk-3 is present in WinRPM?(somehere in .julia\packages\WinRPM\Y9QdZ\deps\usr\x86\_64-w64-mingw32\sys-root\mingw\bin) .  
I also had a lot of problems using ImageView/Plots with Cairo and Gtk on Windows and tried a lot of workarounds. Last time I tried to install it just worked, so this makes me think that the connection to the servers is quite fragile and you have to keep trying.  
The bad part is that if it fails to download the first time you try, next time you type “using Gtk/Imageview”, it will not complain until you actually try to plot something.  
Before trying again I usually delete Gtk and the contents of WinRPM from the path above. Then add Gtk again and wait for it(it takes a while to build)

Here is my complicated workaround which was successful for a few people(as a last resort):  
[https://github.com/JuliaGraphics/Cairo.jl/issues/265](https://github.com/JuliaGraphics/Cairo.jl/issues/265)

---

<div class="post-metadata">

### Author: ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)
#### Post date: [August 19, 2019, 9:16am UTC](https://discourse.julialang.org/t/gtk-and-libgtk-3/27699/3 "2019-08-19T09:16:00Z")

</div>

You can also try to rebuild Gtk with :

`]build Gtk`

---

<div class="post-metadata">

### Author: ![jar](https://avatars.discourse-cdn.com/v4/letter/j/45deac/32.png) [@jar](https://discourse.julialang.org/u/jar)
#### Post date: [August 19, 2019, 5:17pm UTC](https://discourse.julialang.org/t/gtk-and-libgtk-3/27699/4 "2019-08-19T17:17:44Z")

</div>

Guys.  
I uninstall Gtk and not, don’t work…  
build Gtk but don’t work.  
This I solved by installing an extension in vscode  
[https://github.com/yzhang-gh/vscode-jupyter](https://github.com/yzhang-gh/vscode-jupyter)

Thanks to all.

Regards.
