Cannot add scipy to pycharm - python

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.

Related

IDE when import scipy, ImportError: DLL load failed: The specified procedure could not be found

When I use pycharm to run my code with from scipy import stats:
Importerror occurs: DLL load failed: The specified procedure could not be found.
Platform: Anaconda, python 3.7
IDE: pycharm, Microsoft VS code
Anaconda is installed in D:\Anaconda
The scipy package is installed properly. The code can be run successfully in Jupyter.
I have tried the similar questions, but no one can help. Can anybody give me some help to fix it?
I have also reinstalled Anaconda, however, it still faied.
From scipy import stats:
Traceback (most recent call last): ...from scipy import stats File
"D:\Anaconda3\lib\site-packages\scipy\stats__init__.py", line 345, in
from .stats import * File "D:\Anaconda3\lib\site-packages\scipy\stats\stats.py", line 171, in
from . import distributions File "D:\Anaconda3\lib\site-packages\scipy\stats\distributions.py", line
10, in
from ._distn_infrastructure import (entropy, rv_discrete, rv_continuous, File
"D:\Anaconda3\lib\site-packages\scipy\stats_distn_infrastructure.py",
line 24, in
from scipy import optimize File "D:\Anaconda3\lib\site-packages\scipy\optimize__init__.py", line 271,
in
from ._minimize import * File "D:\Anaconda3\lib\site-packages\scipy\optimize_minimize.py", line 21,
in
from scipy.sparse.linalg import LinearOperator File "D:\Anaconda3\lib\site-packages\scipy\sparse\linalg__init__.py", line
117, in
from .eigen import * File "D:\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen__init__.py",
line 11, in
from .arpack import * File "D:\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack__init__.py",
line 22, in
from .arpack import * File "D:\Anaconda3\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py",
line 45, in
from . import _arpack ImportError: DLL load failed: The specified procedure could not be found.
enter image description here
I solved it!
I think there must be something wrong in Scipy packages in Conda, so I remove all the packages related to Ski-learn, and download from "https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy".
Choose numpy+whl Scipy ski-learn(corresponding edition) after downloading and install it by pip.

pip install of statsmodels is not working. DLL load failed: The specified module could not be found

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

Error while installing SciPy.stats

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.

Python 2.5.... MatPlotLib doesn't install PyLab

I have NumPy and SciPy installed and working. I'm using Python 2.5 (MIT Intro to Programming course) so I've been installing the packages with .exe files instead of Pip or Anaconda. With MatPlotLib, I get the following errors during installation:
could not create: matplotlib-py2.5
could not create: python 2.5 matplotlib-1.0.0
could not set key value: "C:\Python25\Removematplotlib.exe" -u "C:\Python25\matplotlib-wininst.log"
I have a MatPlotLib folder in Python's Lib/site-packages directory. Importing matplotlib into IDLE works fine. But when I try to import pylab:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import pylab
File "C:\Python25\Lib\site-packages\pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 216, in <module>
from matplotlib import mpl # pulls in most modules
File "C:\Python25\Lib\site-packages\matplotlib\mpl.py", line 1, in <module>
from matplotlib import artist
File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 6, in <module>
from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
File "C:\Python25\Lib\site-packages\matplotlib\transforms.py", line 34, in <module>
from matplotlib._path import affine_transform
ImportError: DLL load failed: The specified module could not be found.
I've looked around on different message boards but can't find anyone else with this issue.
Any ideas?

Running python script with dependencies on libraries from a virtualenv

I'm trying to run a naive bayes script that needs NumPy, SciPy and Pandas to run. To avoid the confusion with the multiple copies of python on Macs 10.7 --and because I couldn't figure out how to, really - I made a virtualenv and installed NumPy and SciPy there, checking that after running
$ python
>>> import numpy
>>> import scipy
everything works. Now, I'm in my file's directory, and running python nb_predict.py gives me a bunch of errors.
Originally, the path to my python compiler at the top of my file was
#!/usr/local/bin/python
but since I didn't know if it had changed after installing everything in the virtual env, I've tried it with:
#!/Users/myusername/.virtualenvs/scipy/bin/python
and it still doesn't work. I've made the script executable, also.
Please, any help would be greatly appreciated!
This is what I get as the error:
Traceback (most recent call last):
File "nb_predict.py", line 3, in <module>
from sklearn.naive_bayes import MultinomialNB
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/naive_bayes.py", line 25, in <module>
from .preprocessing import binarize
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/preprocessing/__init__.py", line 22, in <module>
from .imputation import Imputer
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scikit_learn-0.15_git-py2.7-macosx-10.9-intel.egg/sklearn/preprocessing/imputation.py", line 10, in <module>
from scipy import stats
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/stats/__init__.py", line 332, in <module> from .stats import *
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/stats/stats.py", line 181, in <module>
import scipy.special as special
File "/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/special/__init__.py", line 532, in <module>
from ._ufuncs import *
ImportError: dlopen(/Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/special/_ufuncs.so, 2): Symbol not found: ___sincos_stret
Referenced from: /Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/special/_ufuncs.so
Expected in: /usr/lib/libSystem.B.dylib
in /Users/myusername/.virtualenvs/scipy/lib/python2.7/site-packages/scipy-0.14.0.dev_572aaf0-py2.7-macosx-10.9-intel.egg/scipy/special/_ufuncs.so

Categories

Resources