Reputation: 3549
Fresh install of anaconda python3 onto secondary hard drive of mac running mavericks.
import sklearn
gives
Library not loaded: /usr/local/lib/libgcc_s.1.dylib
Referenced from: /Volumes/SecondHD/anaconda/lib/python3.5/site-packages/scipy/sparse/linalg/isolve/_iterative.so
Reason: image not found
gcc was installed with home-brew and exists.
which gcc
gives
/usr/bin/gcc
In /usr/local/Cellar/gcc/6.1.0/lib/gcc/6 I can find libgcc_s.1.dylib so I know it's there even tho it was not symlinked in /usr/local/lib.
Rather than adding more symlinks to /usr/local/lib from all the libraries in Cellar, I instead added the location of the libraries to the search path.
In my ~.profile I have
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib"
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/Cellar/gcc/6.1.0/lib/gcc/6"
But that does not work. However, the error goes away if I add this line to my .profile
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/Cellar/gcc/6.1.0/lib/gcc/6
My understanding from this post is that LIBRARY_PATH is a list of places a compiler (like gcc) will look for libraries when it is linking code. But in Mac OSX, DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH contain a list of places any program will search for a shared library when it runs.
So if sklearn wants a gcc library, that would mean some compilation (and linking) will happen. Why is this line not sufficient
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/Cellar/gcc/6.1.0/lib/gcc/6"
and why is DYLD_FALLBACK_LIBRARY_PATH or DYLD_LIBRARY_PATH needed?
Upvotes: 2
Views: 742
Reputation: 498
I had the same problem. What I did was creating symbolic links from my cellar folder of gcc to /usr/local/lib.
look for the right path of you gcc
ln -s /usr/local/Cellar/gcc/X.X.X/lib/gcc/6/* /usr/local/lib
Upvotes: 2