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

Can't load module libopenblas #76

Closed
bjarkehs opened this issue Apr 2, 2014 · 31 comments
Closed

Can't load module libopenblas #76

bjarkehs opened this issue Apr 2, 2014 · 31 comments

Comments

@bjarkehs
Copy link

bjarkehs commented Apr 2, 2014

I get the following error when I run julia on a clean installation:

Warning: error initializing module LinAlg:
ErrorException("could not load module libopenblas: dlopen(libopenblas.dylib, 1): image not found")

I googled it and found this issue on Julia's Rmath module where the same error occurs:
JuliaStats/Rmath-julia#3

The problem seems to be that julia doesn't install it as a dependency, because @staticfloat asked if the following command could be run otool -L /usr/local/lib/libopenblas.dylib. When I did this I received:

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: /usr/local/lib/libopenblas.dylib (No such file or directory)

My installation was done with brew install --HEAD --64bit julia and it seems like the openblas dependency isn't installed with julia.

@ggarza
Copy link

ggarza commented Apr 2, 2014

I get the same thing. openblas-julia is keg-only, so I think it should be somewhere else. Poking around, it seems to be in /usr/local/opt/openblas-julia.

Running otool -L /usr/local/opt/openblas-julia/lib/libopenblas.dylib gives the following.

/usr/local/opt/openblas-julia/lib/libopenblas.dylib:
/usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylib
(compatibility version 0.0.0, current version 0.0.0)
/usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.3.dylib
(compatibility version 4.0.0, current version 4.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
1197.1.1) /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libquadmath.0.dylib
(compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
2577.0.0)

Adding push!(DL_LOAD_PATH, "/usr/local/opt/openblas-julia/lib/") to my ~/.juliarc.jl doesn't seem to help, either.

@ggarza
Copy link

ggarza commented Apr 2, 2014

I also get the could not load module libRmath-julia: dlopen(libRmath-julia.dylib, 1): image not found error, btw

@ggarza
Copy link

ggarza commented Apr 3, 2014

I've done brew rm openblas-julia && HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew reinstall --HEAD julia 2>&1 | tee ~/julia_verbose and put the output here: https://gist.github.com/ggarza/9946609

The output of brew --config is below. Also, brew doctor doesn't report anything worth mentioning.

HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: 88f0fdf62804017c5d747fb9f5ed708f484f573b
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit ivybridge
OS X: 10.9.2-x86_64
Xcode: 5.1
CLT: 5.1.0.0.1.1393561416
Clang: 5.1 build 503
X11: 2.7.5 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby

One thing I notice is that my system has an ivybridge processor and otool lists library called 'libopenblas_sandybridgep-r0.2.8.dylib'

@staticfloat
Copy link
Owner

I've pushed a fix for this. Please confirm that it works for you by uninstalling and reinstalling julia.

I was mistaken before, libopenblas should not be installed into the global /usr/local/lib/ directory, so that's fine. The problem was that because the name of the binary was changed from julia-readline/julia-basic to just julia, the special handling to add the openblas library search path to Julia failed.

@ggarza
Copy link

ggarza commented Apr 5, 2014

I still get errors. When running brew test --HEAD julia I get the following

Testing julia
==> /usr/local/Cellar/julia/HEAD/bin/julia runtests.jl all
    From worker 5:      From worker 3:      From worker 2:      From worker 4:       * core
     * linalg2
     * linalg1
     * linalg3
    From worker 5:       * keywordargs
    From worker 5:       * numbers
    From worker 4:       * strings
    From worker 4:       * collections
    From worker 5:       * hashing
    From worker 4:       * remote
    From worker 4:       * iobuffer
    From worker 4:       * arrayops
    From worker 5:       * simdloop
    From worker 5:       * blas
    From worker 5:       * fft
    From worker 5:       * dsp
    From worker 5:       * sparse
    From worker 4:       * bitarray
    From worker 5:       * random
    From worker 5:       * math
    From worker 5:       * functional
    From worker 5:       * bigint
    From worker 5:       * sorting
    From worker 5:       * statistics
    From worker 5:       * spawn
    From worker 4:       * priorityqueue
    From worker 5:         [stdio passthrough ok]
    From worker 4:       * arpack
exception on 4: ERROR: error compiling naupd: could not load module libarpack: dlopen(libarpack.dylib, 1): Library not loaded: /usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylib
  Referenced from: /usr/local/opt/arpack-julia/lib/libarpack.dylib
  Reason: image not found
while loading arpack.jl

@staticfloat
Copy link
Owner

Is there a /usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylib
file on yout computer?

On Sat, Apr 5, 2014 at 1:07 PM, Guillermo Garza [email protected]:

I still get errors. When running brew test --HEAD julia I get the
following

Testing julia
==> /usr/local/Cellar/julia/HEAD/bin/julia runtests.jl all
From worker 5: From worker 3: From worker 2: From worker 4: * core
* linalg2
* linalg1
* linalg3
From worker 5: * keywordargs
From worker 5: * numbers
From worker 4: * strings
From worker 4: * collections
From worker 5: * hashing
From worker 4: * remote
From worker 4: * iobuffer
From worker 4: * arrayops
From worker 5: * simdloop
From worker 5: * blas
From worker 5: * fft
From worker 5: * dsp
From worker 5: * sparse
From worker 4: * bitarray
From worker 5: * random
From worker 5: * math
From worker 5: * functional
From worker 5: * bigint
From worker 5: * sorting
From worker 5: * statistics
From worker 5: * spawn
From worker 4: * priorityqueue
From worker 5: [stdio passthrough ok]
From worker 4: * arpack
exception on 4: ERROR: error compiling naupd: could not load module libarpack: dlopen(libarpack.dylib, 1): Library not loaded: /usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylib
Referenced from: /usr/local/opt/arpack-julia/lib/libarpack.dylib
Reason: image not found
while loading arpack.jl

Reply to this email directly or view it on GitHubhttps://github.com//issues/76#issuecomment-39649419
.

@staticfloat
Copy link
Owner

Can you otool -L that file

On Sat, Apr 5, 2014 at 1:22 PM, Guillermo Garza [email protected]:

file
/usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylibgives
/usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylib:
Mach-O 64-bit dynamically linked shared library x86_64

Reply to this email directly or view it on GitHubhttps://github.com//issues/76#issuecomment-39649786
.

@ggarza
Copy link

ggarza commented Apr 5, 2014

I had done brew reinstall openblas-julia --HEAD earlier. I've just done brew reinstall openblas-julia. The results from otool -L are

otool -L  /usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylib
/usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylib:
    /usr/local/opt/openblas-julia/lib/libopenblas_sandybridgep-r0.2.8.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 2577.0.0)

@ggarza
Copy link

ggarza commented Apr 5, 2014

Running brew test julia --HEAD - v now gives a different error.

==> /usr/local/Cellar/julia/HEAD/bin/julia runtests.jl all
    From worker 5:       * core
    From worker 3:      From worker 4:      From worker 2:       * linalg2
     * linalg3
     * linalg1
    From worker 5:       * keywordargs
    From worker 5:       * numbers
    From worker 4:       * strings
exception on 2: ERROR: no method convert(Type{Float16}, Float32)
while loading linalg1.jl, in expression starting on line 22
ERROR: no method convert(Type{Float16}, Float32)
while loading linalg1.jl, in expression starting on line 22
while loading /usr/local/Cellar/julia/HEAD/share/julia/test/runtests.jl, in expression starting on line 35

Error: julia: failed

@ggarza
Copy link

ggarza commented Apr 5, 2014

That was after I did brew reinstall openblas-julia && brew reinstall julia --HEAD

@ggarza
Copy link

ggarza commented Apr 5, 2014

ERROR: no method convert(Type{Float16}, Float32) is also present in non-homebrew julia

@staticfloat
Copy link
Owner

I see the same thing. I think it's a current broken julia build.

On Sat, Apr 5, 2014 at 1:34 PM, Guillermo Garza [email protected]:

That was after I did brew reinstall openblas-julia && brew reinstall
julia --HEAD

Reply to this email directly or view it on GitHubhttps://github.com//issues/76#issuecomment-39650031
.

@ggarza
Copy link

ggarza commented Apr 6, 2014

@staticfloat I'm pretty sure you've fixed this issue. I think you can close it.

Thanks!!

@bjarkehs
Copy link
Author

bjarkehs commented Apr 7, 2014

Hmm.. I've done a complete reinstall by running:

brew rm julia arpack-julia arpack64-julia openblas-julia openblas64-julia suite-sparse-julia suite-sparse64-julia

And then installing with brew install --HEAD --64bit julia at first I got:

Warning: error initializing module LinAlg:
ErrorException("could not load module libopenblas: dlopen(libopenblas.dylib, 1): image not found")

So I ran brew doctor and it wanted me to install arpack-julia, openblas-julia, and suite-sparse-julia alongside their 64bit counterparts.

So I did that, but it's still giving:

Warning: error initializing module LinAlg:
ErrorException("could not load module libopenblas: dlopen(libopenblas.dylib, 1): image not found")

I ran otool -L on the libopenblas.dylib I found in /usr/local/opt/openblas-julia/lib/libopenblas.dylib and it gave this:

otool -L  /usr/local/opt/openblas-julia/lib/libopenblas.dylib 
/usr/local/opt/openblas-julia/lib/libopenblas.dylib:
    /usr/local/opt/openblas-julia/lib/libopenblas_penrynp-r0.2.8.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 2577.0.0)

However, this is not the 64 bit version, so I tried for that one aswell:

otool -L /usr/local/opt/openblas64-julia/lib/libopenblas.dylib
/usr/local/opt/openblas64-julia/lib/libopenblas.dylib:
    /usr/local/opt/openblas64-julia/lib/libopenblas_penrynp-r0.2.8.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 2577.0.0)

@ggarza
Copy link

ggarza commented Apr 7, 2014

What does the output of otool -l /usr/local/Cellar/julia/HEAD/bin/julia give?

@ggarza
Copy link

ggarza commented Apr 7, 2014

Also, try running julia-debug and see if you get the same errors?

@ggarza
Copy link

ggarza commented Apr 7, 2014

One last thing, did you run brew update before reinstalling?

@bjarkehs
Copy link
Author

bjarkehs commented Apr 8, 2014

Okay, I redid everything. Making sure I had run both brew update and brew upgrade. I uninstalled everything that had anything to do with Julia, and now it's working.

I guess I had managed to fuck up one of the steps.

Thanks @staticfloat :)

@aj0strow
Copy link

I'm getting this issue too. Was there a fix?

$ brew test -v julia
Testing julia
==> /usr/local/Cellar/julia/0.3.3/bin/julia -e Base.runtests("core")
Warning: error initializing module LinAlg:
ErrorException("error compiling __init__: error compiling check_blas: error compiling openblas_get_config: could not load module libopenblas: dlopen(libopenblas.dylib, 1): Library not loaded: /usr/local/lib/gcc/x86_64-apple-darwin13.4.0/4.9.2/libgfortran.3.dylib
  Referenced from: /usr/local/opt/openblas-julia/lib/libopenblas.dylib
  Reason: image not found")
ERROR: error compiling runtests: error compiling runtests: error compiling versioninfo: error compiling openblas_get_config: could not load module libopenblas: dlopen(libopenblas.dylib, 1): Library not loaded: /usr/local/lib/gcc/x86_64-apple-darwin13.4.0/4.9.2/libgfortran.3.dylib
  Referenced from: /usr/local/opt/openblas-julia/lib/libopenblas.dylib
  Reason: image not found
 in process_options at /usr/local/Cellar/julia/0.3.3/lib/julia/sys.dylib
 in _start at /usr/local/Cellar/julia/0.3.3/lib/julia/sys.dylib (repeats 2 times)

Error: julia: failed
Failed executing: /usr/local/Cellar/julia/0.3.3/bin/julia -e Base.runtests("core")
/usr/local/Library/Homebrew/formula.rb:644:in `system'
/usr/local/Library/Taps/staticfloat/homebrew-julia/julia.rb:225:in `test'
/usr/local/Library/Homebrew/formula.rb:562:in `block in run_test'
/usr/local/Library/Homebrew/extend/fileutils.rb:21:in `mktemp'
/usr/local/Library/Homebrew/formula.rb:560:in `run_test'
/usr/local/Library/Homebrew/cmd/test.rb:59:in `block (2 levels) in test'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
/usr/local/Library/Homebrew/cmd/test.rb:58:in `block in test'
/usr/local/Library/Homebrew/cmd/test.rb:37:in `each'
/usr/local/Library/Homebrew/cmd/test.rb:37:in `test'
/usr/local/Library/brew.rb:136:in `<main>'

@staticfloat
Copy link
Owner

The root cause of this is that you need to reinstall gcc and openblas-julia, suite-sparse-julia and arpack-julia. Note how it is complaining:

Library not loaded: /usr/local/lib/gcc/x86_64-apple-darwin13.4.0/4.9.2/libgfortran.3.dylib

This is because the path to the libraries within gcc change every time that gcc receives a minor version bump (the 4.9.2 in the path above) as well as every time Apple releases a new OSX minor version number (the 13.4.0 in the path above). To fix it, you'll need to:

$ brew rm --force gcc openblas-julia arpack-julia suite-sparse-julia
$ brew update
$ brew install julia

This should fix it in the short term. HOWEVER. Rejoice! For a long-term fix is ALMOST ready. Once that bad boy comes out, we won't have to worry about this anymore, and things should "just work" for you as a user.

@aj0strow
Copy link

Removing and reinstalling didn't work for me, but looking forward to the long-term fix. I'll check back every couple days.

@staticfloat
Copy link
Owner

What does the following say for you:

find /usr/local/lib -name libgfortran.3.dylib

@aj0strow
Copy link

Ehm, nothing comes back. But i feel like i have fortran.

$ find /usr/local/lib -name libgfortran.3.dylib
$ which gfortran
/usr/local/bin/gfortran

@staticfloat
Copy link
Owner

Interesting. What happens if you do it without the lib on the end:

$ find /usr/local -name libgfortran.3.dylib

@aj0strow
Copy link

Seems to be in the homebrew dir. Am i missing a link of some sort?

$ find /usr/local -name libgfortran.3.dylib
/usr/local/Cellar/gcc/4.9.2/lib/gcc/x86_64-apple-darwin13.4.0/4.9.2/i386/libgfortran.3.dylib
/usr/local/Cellar/gcc/4.9.2/lib/gcc/x86_64-apple-darwin13.4.0/4.9.2/libgfortran.3.dylib
/usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.3.dylib

$ brew link gfortran
Warning: Already linked: /usr/local/Cellar/gfortran/4.8.2

@staticfloat
Copy link
Owner

Ah, gfortran is old. You should uninstall gfortran. The new way Homebrew provides gfortran is through the gcc formula. When you install gcc, it provides gfortran automatically. Try the following:

$ brew rm --force gfortran
$ brew link gcc
$ brew install julia

@aj0strow
Copy link

And fixed! Thank you for walking me thru. Much appreciated.

@staticfloat
Copy link
Owner

Yep! No problem. Glad it's fixed.

@scott-maddox
Copy link

To summarize, the following one-liner should fix this problem:

brew rm --force gcc gfortran openblas-julia arpack-julia suite-sparse-julia && brew update && brew install julia

@hayd
Copy link

hayd commented Oct 6, 2015

@scott-maddox Thanks, this hit me too.

@kirk86
Copy link

kirk86 commented Mar 5, 2018

@staticfloat I cannot uninstall julia, keep getting the following error:

brew uninstall julia
Warning: Calling 'depends_on :fortran' is deprecated!
Use 'depends_on "gcc"' instead.
/usr/local/Homebrew/Library/Taps/staticfloat/homebrew-julia/julia.rb:40:in `<class:Julia>'
Please report this to the staticfloat/julia tap!

Error: Permission denied @ rb_file_s_lstat - /usr/local/Cellar/julia/HEAD/lib/julia/sys.dylib.dSYM/Contents

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

7 participants