Spyder: Can't import Scipy in latest Spyder version (Anaconda)

Created on 28 Jul 2017  路  8Comments  路  Source: spyder-ide/spyder

Description of your problem

  1. I updated the to the latest spyder version using conda update conda +conda update spyder
    During this process I got the following warning:
    INFO menuinst_win32:__init__(182): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'C:\Anaconda3', env_name: 'None', mode: 'None', used_mode: 'system'

  2. Now any import that calls some sub-module of scipy doesnt work

from scipy import stats

Traceback (most recent call last):

  File "<ipython-input-3-9d55e67ee92d>", line 1, in <module>
    from scipy import stats

  File "C:\Anaconda3\lib\site-packages\scipy\stats\__init__.py", line 348, in <module>
    from .stats import *

  File "C:\Anaconda3\lib\site-packages\scipy\stats\stats.py", line 175, in <module>
    import scipy.special as special

  File "C:\Anaconda3\lib\site-packages\scipy\special\__init__.py", line 648, in <module>
    from ._ellip_harm import ellip_harm, ellip_harm_2, ellip_normal

  File "C:\Anaconda3\lib\site-packages\scipy\special\_ellip_harm.py", line 7, in <module>
    from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm

ImportError: cannot import name '_ellipsoid'

What is the expected output? What do you see instead?
Normal importing.

Please provide any additional information below

  • I already tried to reinstall scipy, revert to scipy 0.19.0 (just recently updated to 0.19.1)
  • I removed Spyder 3.2.0 and reinstalled 3.1.4 that solved the problem.

Strangely enough the import works with no problem when I call it from the command line, both in a ipython and in python console

Versions and main components

  • Spyder Version: 3.2.0
  • Python Version: 3.5.2
  • Qt Version: 5.6.2
  • PyQt Version: 5.6
  • Operating system: Windows 10, Anaconda 64bit

Dependencies

IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : 0.25.2 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.2.1 (OK)
numpy >=1.7 : 1.13.1 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.5.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.2 (OK)
qtconsole >=4.2.0: 4.3.0 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
sympy >=0.7.3 : 1.1 (OK)

IPython Console Bug

All 8 comments

@dalthviz, please try to run from scipy import stats on Windows to see if you have the same result than @skjerns.

@ccordoba12 I tried the import but it works for me:

imagen

@skjerns could you try to update again Spyder with conda update -f spyder? all the info you can provied us will be greatly appreciated :)

I have the same problem.
I installed the latest version of spyder using pip install -U spyder, and executing in spyder (does not matter if in current or dedicated console) scripts like import scipy.stats causes the same error as above:

Traceback (most recent call last):

  File "<ipython-input-1-99c07a9cb063>", line 1, in <module>
    runfile('D:/python-prog/test_script.py', wdir='D:/python-prog')

  File "d:\python36\lib\site-packages\spyder\utils\site\sitecustomize.py", line 688, in runfile
    execfile(filename, namespace)

  File "d:\python36\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/python-prog/test_script.py", line 9, in <module>
    import scipy.stats

  File "d:\python36\lib\site-packages\scipy\stats\__init__.py", line 348, in <module>
    from .stats import *

  File "d:\python36\lib\site-packages\scipy\stats\stats.py", line 175, in <module>
    import scipy.special as special

  File "d:\python36\lib\site-packages\scipy\special\__init__.py", line 648, in <module>
    from ._ellip_harm import ellip_harm, ellip_harm_2, ellip_normal

  File "d:\python36\lib\site-packages\scipy\special\_ellip_harm.py", line 7, in <module>
    from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm

ImportError: cannot import name '_ellipsoid'

The same error appears when executing import scipy.stats in spyder's ipython console.
No error appears when executing import scipy.stats in ipython standalone console or when executing a script with this line from the command line.

I tried reinstalling scipy 0.19.1 and spyder 3.2.0, but the error persists.

Versions and main components

  • Spyder version 3.2.0
  • Python version 3.6.0, 64-bit
  • PyQt version 5.9
  • Scipy version 0.19.1 (from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy)
  • Operating system: Windows 8.1

Dependencies

IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : 0.26 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.2.1 (OK)
numpy >=1.7 : 1.13.1 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.5.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.2 (OK)
qtconsole >=4.2.0: 4.3.0 (OK)
rope >=0.9.4 : 0.10.5 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
sympy >=0.7.3 : 1.1.1 (OK)

@dalthviz, please create an empty conda environment and install everything with pip there, including Spyder and PyQt5.

@ccordoba12 I created the env but I can import from scipy. Although to install it I used the wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy and also installed numpy+MKL from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

Thanks for the check @dalthviz. I also tried to reproduce this problem on my end, but was unable to.

Addendum to my previous reply:
The problem did not appear for me in a virtual environment with only numpy and scipy (both from http://www.lfd.uci.edu/~gohlke/pythonlibs/) and spyder with its dependencies (installed using pip).
Some time later I deleted Python 3.6.0 and installed 3.6.2, after which the problem did not reappear.

3.6.0 had some troubles with compiled dependencies, so that could have been the cause of the problem.

Was this page helpful?
0 / 5 - 0 ratings