# "could not load library" problem from inside Juno

**URL:** https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128
**Category:** New to Julia
**Tags:** juno
**Created:** [April 6, 2020, 9:48pm UTC](https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128 "2020-04-06T21:48:31Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![nshaviv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nshaviv/32/13907_2.png) [@nshaviv](https://discourse.julialang.org/u/nshaviv)
#### Post date: [April 6, 2020, 9:48pm UTC](https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128/1 "2020-04-06T21:48:31Z")

</div>

I am an enthusiastic julia newbie. I was trying to run ArrayFire (i.e., use the GPU with Julia). After downloading and installing ArrayFire and ArrayFire.jl, it worked in Julia running from the command line, but not through Atom/Juno.

From the command line it worked because I added setenv LD\_LIBRARY\_PATH /opt/arrayfire/lib to my .tcshrc (yes, people still use it).

For juno, I added

```julia
ENV["LD_LIBRARY_PATH"] = "/opt/arrayfire/lib"
ENV["DYLD_LIBRARY_PATH"] = "/opt/arrayfire/lib"

```

to .julia/config/startup.jl

When running Julia through Juno ENV does show that the above were set, however, the commands:

```julia
using ArrayFire 
a = rand(AFArray{Float64},100,100)

```

produce the error

```julia
ERROR: error compiling rand: could not load library "libaf.3"
dlopen(libaf.3.dylib, 1): image not found

```

I’m a bit clueless… how do I force Juno to be aware of the library?  
Any suggestions will be appreciated (especially if they will resolve the problem 😉 )

More about the system  
Mac Book Pro running OS X 10.15.3  
Julia Version 1.3.1  
Atom version 1.45.0  
julia-client 0.12.3

Thanks!  
– Nir

---

<div class="post-metadata">

### Author: ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)
#### Post date: [April 7, 2020, 2:11am UTC](https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128/2 "2020-04-07T02:11:16Z")

</div>

Out of curiosity have you tried logging out and logging back in? Or maybe launching atom from a terminal? Setting LD\_LIBRARY\_PATH in. tschrc **should** also affect the environment of Atom (and it’s child processes), assuming atom was started from a process that had that environment variable set.

---

<div class="post-metadata">

### Author: ![nshaviv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nshaviv/32/13907_2.png) [@nshaviv](https://discourse.julialang.org/u/nshaviv)
#### Post date: [April 7, 2020, 7:23am UTC](https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128/3 "2020-04-07T07:23:54Z")

</div>

I tried running Atom from the command line, logging out and even rebooting for good measure. Didn’t work.

I should add that sometimes running using ArrayFire produces the library finding error:

```julia
julia> using ArrayFire
ERROR: InitError: error compiling __init__ : could not load library "libaf.3"
dlopen(libaf.3.dylib, 1): image not found
Stacktrace:
 [1] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:692
 [2] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:776
 [3] _require(::Base.PkgId) at ./loading.jl:1001
 [4] require(::Base.PkgId) at ./loading.jl:922
 [5] require(::Module, ::Symbol) at ./loading.jl:917
during initialization of module ArrayFire

```

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [April 7, 2020, 7:30am UTC](https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128/4 "2020-04-07T07:30:43Z")

</div>

Can you try putting

```julia
process.env["LD_LIBRARY_PATH"] = "/opt/arrayfire/lib"
process.env["DYLD_LIBRARY_PATH"] = "/opt/arrayfire/lib"

```

into Atom’s init script (press Cmd-Shift-P and type in `init script`)?

---

<div class="post-metadata">

### Author: ![nshaviv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nshaviv/32/13907_2.png) [@nshaviv](https://discourse.julialang.org/u/nshaviv)
#### Post date: [April 7, 2020, 7:34am UTC](https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128/5 "2020-04-07T07:34:32Z")

</div>

Bingo! This did it. Thanks! 😃

---

<div class="post-metadata">

### Author: ![Fisheryu1234](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fisheryu1234/32/9588_2.png) [@Fisheryu1234](https://discourse.julialang.org/u/Fisheryu1234)
#### Post date: [February 27, 2021, 1:02am UTC](https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128/6 "2021-02-27T01:02:05Z")

</div>

> [@pfitzseb](#):
>
> process.env

It works for my solver in Ipopt for JuMP too! This

---

<div class="post-metadata">

### Author: ![Fisheryu1234](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fisheryu1234/32/9588_2.png) [@Fisheryu1234](https://discourse.julialang.org/u/Fisheryu1234)
#### Post date: [March 12, 2021, 6:33pm UTC](https://discourse.julialang.org/t/could-not-load-library-problem-from-inside-juno/37128/7 "2021-03-12T18:33:06Z")

</div>

Hi, is it possible to implement in the similar way in VScode? I am migrating from Atom to VScode Julia
