Traceback (most recent call last):
File "project.py", line 2, in <module>
import sklearn
File "/usr/local/lib/python3.6/site-packages/sklearn/__init__.py", line 134, in <module>
from .base import clone
File "/usr/local/lib/python3.6/site-packages/sklearn/base.py", line 11, in <module>
from scipy import sparse
ModuleNotFoundError: No module named 'scipy'
I've installed the sklearn package, but whenever I try to run the script with import sklearn I keep getting these errors.
The terminal is telling me it is installed.
Requirement already satisfied: sklearn in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.6/site-packages (from sklearn)
You're just missing another requirement which is scipy. You just need to run pip3 install scipy.
As noted by #sascha you may want to follow the system install instructions recommended by the scipy project.
Related
i get this error when running a python script
Traceback (most recent call last):
File "C:\Users\BruceWayne\Desktop\TF\train.py", line 2, in <module>
import numpy
ImportError: No module named numpy
So i tried
pip install numpy
and the answer was that the requirement is already satisfied
Python version : 3.5.2
I getting started with machine learning and things... So I installed sklearn and some other packages form pip. All of them were able to be installed successfully except sklearn so, I downloaded the wheel and installed it from here. It was successfully installed but when i tried to import it in the order to check correct installation, I got tons of error :
Traceback (most recent call last):
File "C:\MyFiles\Programs\Python\PlayGround.py", line 1, in
import sklearn
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn__init__.py", line 134, in
from .base import clone
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\base.py", line 12, in
from .utils.fixes import signature
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils__init__.py", line 11, in
from .validation import (as_float_array,
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\validation.py", line 18, in
from ..utils.fixes import signature
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\fixes.py", line 144, in
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg__init__.py", line 114, in
from .isolve import *
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg\isolve__init__.py", line 6, in
from .iterative import *
File "C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in
from . import _iterative
ImportError: DLL load failed: The specified module could not be found.
And the code was just :
import sklearn
I have already checked correct version of wheel package which, I have downloaded.
How can I correct it and why it is occurring?
The following steps solved my problem :
Uninstalling numpy, sklearn and scipy.
Downloading numpy+mkl and scipy from here.
Firstly installing numpy+mkl and then scipy.
Installing sklearn from pip.
Various things need to be checked:
Check numpy, scipy installation versions.
If they are correct then try to import numpy and scipy.
If they getting imported correctly, then clear your temp(c:/users/username/Appdata/local/temp)folder. Restart the machine and try again.
Still if doesn't work, then uninstall scipy, numpy , sklearn and
reinstall the proper wheel files
Download and install numpy+mkl file.
Currently you might have installed only the numpy file.
Go to: https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
Download the corresponding wheel file in which is suitable for your python installation
pip install "/path_to_thefile/numpy-1.14.6+mkl-cp36-cp36m-win_amd64.whl"
This should help you
I am struggling to import Librosa library for sound analyses. When I enter
import librosa
I get the following error
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "c:\python35\lib\site-packages\librosa\__init__.py", line 13, in <module>
from . import decompose
File "c:\python35\lib\site-packages\librosa\decompose.py", line 19, in <module>
import sklearn.decomposition
File "c:\python35\lib\site-packages\sklearn\__init__.py", line 57, in <module>
from .base import clone
File "c:\python35\lib\site-packages\sklearn\base.py", line 12, in <module>
from .utils.fixes import signature
File "c:\python35\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
from .validation import (as_float_array,
File "c:\python35\lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
from ..utils.fixes import signature
File "c:\python35\lib\site-packages\sklearn\utils\fixes.py", line 406, in <module>
if np_version < (1, 12, 0):
TypeError: unorderable types: str() < int()
I am trying to do everything on Windows OS, Python 3.5 64-bit. Do I need to install some other libraries? I already installed a bunch of other libraries like numpy, matplotlib, scipy and few other essential ones. Please explain what's going on :(
Try using: pip install librosa
You should get a bunch of messages like:
Collecting librosa
Downloading librosa-0.5.1.tar.gz (1.5MB)
100% |████████████████████████████████| 1.5MB 312kB/s
Collecting audioread>=2.0.0 (from librosa)
Downloading audioread-2.1.5.tar.gz
Requirement already satisfied: numpy>=1.8.0 in c:\users\j\miniconda3\lib\site-packages (from librosa)
Requirement already satisfied: scipy>=0.13.0 in c:\users\j\miniconda3\lib\site-packages (from librosa)
Requirement already satisfied: scikit-learn>=0.14.0 in c:\users\j\miniconda3\lib\site-packages (from librosa)
Collecting joblib>=0.7.0 (from librosa)
Downloading joblib-0.11-py2.py3-none-any.whl (176kB)
etc. etc. etc.
And then librosa among other libs is installed.
PS. looks like we are working on the same project??
I have been trying to install and use scikit-learn and nltk. However, I get the following error while importing anything:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/sklearn/init.py", line 57, in
from .base import clone
File "/usr/local/lib/python2.7/site-packages/sklearn/base.py", line 11, in
from .utils.fixes import signature
File "/usr/local/lib/python2.7/site-packages/sklearn/utils/init.py", line 10, in
from .murmurhash import murmurhash3_32
File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling
I did a pip uninstall numpy followed by a pip install numpy and also a pip uninstall scikit-learn and again reinstalled it. But the error persists.
I met the same problem today. Now I have solved it.
Because I have installed numPy manually, and I use the command "pip" to install the else package.
Solve way:
find the old version of numPy.
You can import numPy and print the path of it.
delete the folder.
use pip to install again.
I'm trying to install the statsmodels, but I'm getting a dependency error that statsmodels requires patsy. However patsy is already installed:
Baby-Whip$ sudo pip install patsy
Downloading/unpacking patsy
Downloading patsy-0.3.0-py2.py3-none-any.whl (224kB): 224kB downloaded
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from patsy)
Installing collected packages: patsy
Successfully installed patsy
Cleaning up...
Then when I try to install stasmodels:
Baby-Whip$ sudo pip install statsmodels
Downloading/unpacking statsmodels
Downloading statsmodels-0.5.0.tar.gz (5.5MB): 5.5MB downloaded
Running setup.py (path:/private/tmp/pip_build_root/statsmodels/setup.py) egg_info for package statsmodels
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 122, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 122, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
Running pip freeze also lists patsy as an installed package. What am I missing here? Any help would be greatly appreciated.
See above comment for answer. Needed to install six, and run the statmodels install with the above workaround.
Sidenote: kill me