Error while importing statsmodel

722 views
Skip to first unread message

shalu....@gmail.com

unread,
Nov 11, 2017, 1:36:42 PM11/11/17
to pystatsmodels

I am using Spyder 2.7 version (Windows) and then imported module name statsmodels-0.8.0-cp27-cp27m-win_amd64.whl.

It is installed successfully. Now when I am trying to import it like

from statsmodels.formula.api import ols or import statsmodels.api as sm

it is giving an error:

import statsmodels.api as sm Traceback (most recent call last): File "", line 1, in File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\statsmodels__init__.py", line 8, in from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\statsmodels\tools__init__.py", line 1, in from .tools import add_constant, categorical File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\statsmodels\tools\tools.py", line 8, in from scipy.linalg import svdvals File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg__init__.py", line 172, in from .misc import * File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg\misc.py", line 5, in from .blas import get_blas_funcs File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg\blas.py", line 155, in from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.

from statsmodels.formula.api import ols Traceback (most recent call last): File "", line 1, in File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\statsmodels__init__.py", line 8, in from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\statsmodels\tools__init__.py", line 1, in from .tools import add_constant, categorical File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\statsmodels\tools\tools.py", line 8, in from scipy.linalg import svdvals File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg__init__.py", line 172, in from .misc import * File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg\misc.py", line 5, in from .blas import get_blas_funcs File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg\blas.py", line 155, in from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.

Is there a solution for this?

Thanks

josef...@gmail.com

unread,
Nov 11, 2017, 1:46:34 PM11/11/17
to pystatsmodels
That looks like your scipy is incorrectly installed, broken or less likely incompatible with statsmodels or with numpy.

what do you get with just scipy imports?

from scipy import linalg
from scipy import stats


In general I would recommend upgrading to python 3. 
E.g. I have been using WinPython-64bit-3.4.4.5Qt5 for some time now as my main Python version without any problems.

Josef
 

Thanks


shalu....@gmail.com

unread,
Nov 11, 2017, 1:58:19 PM11/11/17
to pystatsmodels
Hi Josef,

Many thanks for the reply.
I am getting this 

>>> >>> >>> import scipy
>>> from scipy import linalg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg\__init__.py", line 172, in <module>
    from .misc import *
  File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
    from .blas import get_blas_funcs
  File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\linalg\blas.py", line 155, in <module>
    from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
>>>

>>> from scipy import stats
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\stats\__init__.py", line 321, in <module>
    from .stats import *
  File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\stats\stats.py", line 180, in <module>
    import scipy.special as special
  File "C:\Python\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\scipy\special\__init__.py", line 601, in <module>
    from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.

I think there is some problem with Scipy?

Thanks

josef...@gmail.com

unread,
Nov 11, 2017, 2:05:27 PM11/11/17
to pystatsmodels
Yes, it's unrelated to statsmodels.

I have seen some errors like this a few years ago, but don't remember what it was. I didn't have problems with any WinPython in a long time, but I also haven't used python 2 in a long time.


Josef

shalu....@gmail.com

unread,
Nov 12, 2017, 10:57:48 AM11/12/17
to pystatsmodels
Thanks Josef for your reply.
I installed WinPython-64bit-3.4.4.5Qt5 as you suggested.
Could you please send me the link so I can download Pandas, Scipy and GDAL for this version?

Thanks
Vishal

josef...@gmail.com

unread,
Nov 12, 2017, 11:15:08 AM11/12/17
to pystatsmodels
On Sun, Nov 12, 2017 at 10:57 AM, <shalu....@gmail.com> wrote:
Thanks Josef for your reply.
I installed WinPython-64bit-3.4.4.5Qt5 as you suggested.
Could you please send me the link so I can download Pandas, Scipy and GDAL for this version?

You could have also installed whatever the latest winpython is.

I never used GDAL, but scipy and pandas are already installed.
I would not change the scipy version unless you know what you are doing.

a more recent pandas version can be installed with pip install

otherwise the gohlke binaries should work with winpython.


Josef

shalu....@gmail.com

unread,
Nov 12, 2017, 12:05:14 PM11/12/17
to pystatsmodels
Many Thanks @ Josef, Everything is fine now :)

Thanks
Vishal
Reply all
Reply to author
Forward
0 new messages