3

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.

Mark Bennett
  • 1,446
  • 2
  • 19
  • 37

1 Answers1

-1

Try this: remove /usr/lib/libSystem.B.dylib temporarily and then reinstall scipy.

Declan
  • 21
  • 3
  • 1
    Very bad advice. I tried to just rename it (luckily!) and could not resintall. Computer freezed. And surprise: it could not boot anymore. Solved it by launching mac in recovery mode, open up terminal, and save back with original name. Phfew – user305883 Jun 26 '19 at 19:32