I'm trying to import scipy.stats on Python 3.5. windows 10.
I am keep getting ImportError: cannot import name 'ellipkm1'.
The Scipy is up to date.
The full Error code-
from scipy import stats
Traceback (most recent call last):
File "<pyshell#76>", line 1, in <module>
from scipy import stats
File "C:\Users\Oriel Perkal\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\stats\__init__.py", line 321, in <module>
from .stats import *
File "C:\Users\Oriel Perkal\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\stats\stats.py", line 180, in <module>
import scipy.special as special
File "C:\Users\Oriel Perkal\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\special\__init__.py", line 603, in <module>
from .basic import *
File "C:\Users\Oriel Perkal\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\special\basic.py", line 14, in <module>
from ._ufuncs import (ellipkm1, mathieu_a, mathieu_b, iv, jv, gamma, psi, zeta,
ImportError: cannot import name 'ellipkm1'
I had the same problem too
Try installing Microsoft Visual C++ Redistributable package.
Just remember install the version x64 or x86 basing on your python version not your OSVersion.
Related
While I am running this code in ubuntu 14.04, I want to calculate the cosine distance of an array with scipy.spatial.distance. But it is throwing me an error in importing scipy.spatial.distance.
import numpy as np
import scipy
from scipy.spatial.distance import pdist
x=np.array([[[-0.22008298, 0.28819615, 0.09895946, 0.16789497, 0.02379252,
-0.25700486, 0.1628186, 0.12296761, 0.01750283]],
[[ 0.29891527, 0.17249978, -0.10084602, -0.16522293, 0.06811064,
0.07434326, -0.19697316, -0.22199543, 0.07647966]],
[[-0.04112297, 0.13392878, -0.06575392, 0.0893533, 0.22577047,
0.00289264, 0.09996213, 0.17324321, 0.08673526]]])
B =x.transpose(1,2,0).reshape(-1,x.shape[0])
print(B.shape)
print (B.ndim)
#array.astype(int)
print(B)
y=1-(pdist(B, metric='cosine'))
print(y)
It is throwing this error,
Traceback (most recent call last):
File "cos1.py", line 3, in <module>
from scipy.spatial.distance import pdist
File "/home/mayesha/venv/local/lib/python2.7/site-packages/scipy/spatial/__init__.py", line 94, in <module>
from .kdtree import *
File "/home/mayesha/venv/local/lib/python2.7/site-packages/scipy/spatial/kdtree.py", line 8, in <module>
import scipy.sparse
File "/home/mayesha/venv/local/lib/python2.7/site-packages/scipy/sparse/__init__.py", line 229, in <module>
from .csr import *
File "/home/mayesha/venv/local/lib/python2.7/site-packages/scipy/sparse/csr.py", line 20, in <module>
from .compressed import _cs_matrix
File "/home/mayesha/venv/local/lib/python2.7/site-packages/scipy/sparse/compressed.py", line 11, in <module>
from scipy._lib._util import _prune_array
File "/home/mayesha/venv/local/lib/python2.7/site-packages/scipy/_lib/_util.py", line 9, in <module>
import inspect
File "/usr/lib/python2.7/inspect.py", line 37, in <module>
import dis
File "/home/mayesha/dis.py", line 2, in <module>
from scipy.spatial.distance import pdist
File "/home/mayesha/venv/local/lib/python2.7/site-packages/scipy/spatial/distance.py", line 119, in <module>
from scipy._lib._util import _asarray_validated
ImportError: cannot import name _asarray_validated
I am using virtual environment with pip.
Can someone help me. Thanks in advance.
pip install -U scipy
This will solve your issue. I have tried and it did for me. You might get an error that scikit-learn is not installed properly. If you get that error, you can first run:
pip install -U scikit-learn
and then rerun the above code.
This line:
from scipy.stats import norm
(The first in file, and even if it is the only line)
results in these errors:
Traceback (most recent call last): File
"C:/Users/user/Documents/KalTech/DataAnalysis/Code/DataScience/Correlations.py",
line 3, in from scipy.stats import norm
File
"C:\Users\user\AppData\Roaming\Python\Python37\site-packages\scipy\stats__init__.py",
line 345, in from .stats import *
File
"C:\Users\user\AppData\Roaming\Python\Python37\site-packages\scipy\stats\stats.py",
line 169, in import scipy.special as special
File
"C:\Users\user\AppData\Roaming\Python\Python37\site-packages\scipy\special__init__.py",
line 640, in from ._ufuncs import *
File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs
ImportError: DLL load failed: The specified module could not be found.
Try removing your current numpy version and installing the numpy-MKL library which is available here.
Download the right version for your python version and pip install it.
I have been trying to import Seaborn in Python 3.6 but I always get an error:
ImportError: DLL load failed: The specified module could not be found.
I tried to install 2 DLLs (msvcp71 and msvcr71) but that did not help. I am using Windows 10.
The full error is:
import seaborn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python36\lib\site-packages\seaborn\__init__.py", line 6, in <module>
from .rcmod import *
File "C:\Python36\lib\site-packages\seaborn\rcmod.py", line 8, in <module>
from . import palettes, _orig_rc_params
File "C:\Python36\lib\site-packages\seaborn\palettes.py", line 12, in <module>
from .utils import desaturate, set_hls_values, get_color_cycle
File "C:\Python36\lib\site-packages\seaborn\utils.py", line 7, in <module>
from scipy import stats
File "C:\Python36\lib\site-packages\scipy\stats\__init__.py", line 343, in <module>
from .stats import *
File "C:\Python36\lib\site-packages\scipy\stats\stats.py", line 169, in <module>
import scipy.special as special
File "C:\Python36\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
The problem was in Scipy so I uninstalled (pip uninstall) it and then reinstalled Scipy. Also reinstalled seaborn. That worked.
Trying to install from .whl didn't work but pip worked.
I am really new to python and I am trying to install the statsmodels module. It seems that since I am on a 64 bits I need to use the following unofficial website http://www.lfd.uci.edu/ I did all I know about how to download a whl and I did download it and used the pip afterwards and all work fine. now when I do pip install statsmodels it work fine. However, in my shell after I try import the stats models I am getting
import statsmodels
Traceback (most recent call last): File "<pyshell#7>", line 1, in <module>
import statsmodels File "D:\Python34\lib\site-packages\statsmodels\__init__.py", line 8, in <module>
from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, File "D:\Python34\lib\site-packages\statsmodels\tools\__init__.py", line 1, in <module>
from .tools import add_constant, categorical File "D:\Python34\lib\site-packages\statsmodels\tools\tools.py", line 8, in <module>
from scipy.linalg import svdvals File "D:\Python34\lib\site-packages\scipy\linalg\__init__.py", line 174, in <module>
from .misc import * File "D:\Python34\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs File "D:\Python34\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.
Any help would be much appreciated.
Thank you in advance
I have system with win7 x64 and code which worked well before with Anaconda2-2.4.0-Windows-x86
from sklearn.linear_model import LinearRegression
But now I get:
File "C:\Anaconda2\lib\site-packages\sklearn\linear_model\__init__.py", line 1
2, in <module>
from .base import LinearRegression
File "C:\Anaconda2\lib\site-packages\sklearn\linear_model\base.py", line 28, i
n <module>
from ..utils import as_float_array, check_array, check_X_y
File "C:\Anaconda2\lib\site-packages\sklearn\utils\__init__.py", line 16, in <
module>
from .class_weight import compute_class_weight, compute_sample_weight
File "C:\Anaconda2\lib\site-packages\sklearn\utils\class_weight.py", line 7, i
n <module>
from ..utils.fixes import in1d
File "C:\Anaconda2\lib\site-packages\sklearn\utils\fixes.py", line 318, in <mo
dule>
from scipy.sparse.linalg import lsqr as sparse_lsqr
File "C:\Anaconda2\lib\site-packages\scipy\sparse\linalg\__init__.py", line 11
3, in <module>
from .matfuncs import *
File "C:\Anaconda2\lib\site-packages\scipy\sparse\linalg\matfuncs.py", line 19
, in <module>
import scipy.misc
File "C:\Anaconda2\lib\site-packages\scipy\misc\__init__.py", line 49, in <mod
ule>
from scipy.special import comb, factorial, factorial2, factorialk
File "C:\Anaconda2\lib\site-packages\scipy\special\__init__.py", line 601, in
<module>
from ._ufuncs import *
ImportError: DLL load failed: The specified procedure could not be found.
Yesterday, I have installed software which brings some python with itself and look like does something else during installation.
In Dependency walker I see following picture:
I have installed Anaconda2-2.4.0-Windows-x86_64 and in this python version all works fine.
Could you please help me to understand what has been changed in system and how I can fix it?(I have completely remove installed software but it does not help)