5

Whenever I attempt to run this code:

from scipy.special import legendre

I keep encountering the following error.

ImportError: 

dlopen(/Users/william/miniconda/envs/myenv/lib/python3.4/site-packages/scipy/special/_ufuncs.so, 2): Symbol not found: ___addtf3
  Referenced from: /Users/william/miniconda/envs/prakenv/lib/python3.4/site-packages/scipy/special/_ufuncs.so
  Expected in: /usr/lib/libSystem.B.dylib

I've tried reverting to previous versions of scipy and using a Python 2.7 conda environment, but the problem persists. I have ever not had this problem before with scipy. Thank you very much!

wil3
  • 2,877
  • 2
  • 18
  • 22
  • 2
    hmm works for me on Anaconda Python 3.4 (not miniconda .. maybe that's broken?) – maxymoo Jul 28 '15 at 05:22
  • I was able to temporary fix the issue by reverting scipy (see below). I just tried running scipy outside of a conda environment and the issue persists, strangely. Thank you for your answer. – wil3 Jul 28 '15 at 05:34
  • 1
    Perhaps related: http://stackoverflow.com/questions/41237147/stuck-on-error-loading-scipy-using-homebrew-install-on-macos-sierra – Jim DeLaHunt May 09 '17 at 20:44

3 Answers3

3

I had a similar problem, except that I was installing scipy in a virtualenv using pip install -r requirements.txt, where one requirement was scipy==0.18.0. I finally resolved it by deleting my pip caches and trying again.

More specifically, I did this:

  1. Deactivate the virtualenv flask
  2. sudo rm -r flask/
  3. Checked my PATH and PYTHONPATH environment variables carefully, getting rid of references to other projects and other Python versions
  4. Set my MacPorts Python version to 2.7, consistent with my project's needs: Sudo port set python python27
  5. Delete my pip caches, rm -r ~/Library/Caches/pip/http/* ~/Library/Caches/pip/wheels/*
  6. Recreated the virtualenv: virtualenv flask
  7. Reactivated the virtualenv: source flask/bin/activate
  8. Performed a make operation which invoked pip install -r requirements.txt

I came up with a shorthand for detecting the problem:

% python -c 'import scipy.special'

When the problem occurred, I got an error response:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/myuser/project/flask/lib/python2.7/site-packages/scipy/special/__init__.py", line 636, in <module>
    from ._ufuncs import *
ImportError: dlopen(/Users/myuser/project/flask/lib/python2.7/site-packages/scipy/special/_ufuncs.so, 2): Symbol not found: ___addtf3
  Referenced from: /Users/myuser/project/flask/lib/python2.7/site-packages/scipy/special/../.dylibs/libquadmath.0.dylib
  Expected in: /usr/lib/libSystem.B.dylib
 in /Users/myuser/project/flask/lib/python2.7/site-packages/scipy/special/../.dylibs/libquadmath.0.dylib

When the problem was corrected, there was no output.

When the test was run in an environment without scipy (e.g. outside the virtualenv), there was the expected error:

ImportError: No module named scipy.special
Jim DeLaHunt
  • 10,960
  • 3
  • 45
  • 74
0

I have a temporary fix (reverting scipy), although I would prefer to determine the exact cause of the problem:

conda uninstall scipy
conda install scipy=0.15.0

This is on Yosemite running in a Python 3.4 miniconda environment.

wil3
  • 2,877
  • 2
  • 18
  • 22
0

There was apparently a problem with conda v 3.15.0 which caused these symptoms. The fix was to release conda v 3.15.1 on 2015-07-23, and have people re-install.

See discussion at conda issue #1467, Error in scipy 0.16 packaging in official conda channels on OSX. Given the timing of your question, just a few days later in July 2015, this might have affected you.

Jim DeLaHunt
  • 10,960
  • 3
  • 45
  • 74