简体   繁体   中英

Stuck on error loading scipy, using Homebrew install, on macOS Sierra

This happens when I try to do:

import scipy.io

Another scipy module, such as scipy.sparse, seems to be OK.

The root error is:

packages/scipy/special/__init__.py", line 636, in <module>
        from ._ufuncs import *
    ImportError: dlopen(/usr/local/lib/python2.7/site-packages/scipy/special/_ufuncs.so, 2): Symbol not found: ___addtf3

The full stack trace:

Traceback (most recent call last):
  File "HistogramClassifier.py", line 3, in <module>
    import scipy.io
  File "/usr/local/lib/python2.7/site-packages/scipy/io/__init__.py", line 97, in <module>
    from .matlab import loadmat, savemat, whosmat, byteordercodes
  File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/__init__.py", line 13, in <module>
    from .mio import loadmat, savemat, whosmat
  File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/mio.py", line 12, in <module>
    from .miobase import get_matfile_version, docfiller
  File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/miobase.py", line 22, in <module>
    from scipy.misc import doccer
  File "/usr/local/lib/python2.7/site-packages/scipy/misc/__init__.py", line 51, in <module>
    from scipy.special import comb, factorial, factorial2, factorialk
  File "/usr/local/lib/python2.7/site-packages/scipy/special/__init__.py", line 636, in <module>
    from ._ufuncs import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/scipy/special/_ufuncs.so, 2): Symbol not found: ___addtf3
  Referenced from: /usr/local/lib/python2.7/site-packages/scipy/special/../.dylibs/libquadmath.0.dylib
  Expected in: /usr/lib/libSystem.B.dylib
 in /usr/local/lib/python2.7/site-packages/scipy/special/../.dylibs/libquadmath.0.dylib

That's pretty much it. Google returns quite a few hits, but they're either very old, or not the same lib, or things that I've tried. The rest of this post is all the stuff I found/tried so far that didn't work.

Double checking python:

which python
/usr/local/bin/python

ls -l /usr/local/bin/python
lrwxr-xr-x  ... /usr/local/bin/python -> ../Cellar/python/2.7.13/bin/python

I'm not currently using virtual env.

I think Homebrew is OK:

brew doctor
Your system is ready to brew.

This is after trying this:

brew update
brew upgrade

I've also tried uninstalling and reinstalling the scipy package, both with brew and with pip.

I've tried various other things, but don't want to mess up a working Homebrew setup.

Older posts that Google brought back talk about "cobra", as far as I know I'm not using that. "which cobra" doesn't return anything.

Other things from Google talk about the order of the library path, but that seemed to be if you were using the built-in python, which I don't don't think is applicable since I believe I'm using Homebrew's version.

Clearly it has something to do with a library, maybe fortran related, but what to type in to fix it... don't know where to start.

尝试以下操作:临时删除/usr/lib/libSystem.B.dylib,然后重新安装scipy。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM