Reputation: 119
I keep trying to import sklearn but I when I do I get the error [ModuleNotFoundError: No module named 'numpy.testing']. I have upgraded numpy, pandas, scipy as well as scikit-learn to the latest versions but I still keep getting the same error. Any idea why. Here is the full error below:
'''
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-152-b7c74cbf5af0> in <module>
----> 1 import sklearn
~\anaconda3\lib\site-packages\sklearn\__init__.py in <module>
80 from . import _distributor_init # noqa: F401
81 from . import __check_build # noqa: F401
---> 82 from .base import clone
83 from .utils._show_versions import show_versions
84
~\anaconda3\lib\site-packages\sklearn\base.py in <module>
15 from . import __version__
16 from ._config import get_config
---> 17 from .utils import _IS_32BIT
18 from .utils._tags import (
19 _DEFAULT_TAGS,
~\anaconda3\lib\site-packages\sklearn\utils\__init__.py in <module>
27 from ..exceptions import DataConversionWarning
28 from .deprecation import deprecated
---> 29 from .fixes import parse_version, threadpool_info
30 from ._estimator_html_repr import estimator_html_repr
31 from .validation import (
~\anaconda3\lib\site-packages\sklearn\utils\fixes.py in <module>
17 import numpy as np
18 import scipy
---> 19 import scipy.stats
20 import threadpoolctl
21 from .._config import config_context, get_config
~\anaconda3\lib\site-packages\scipy\stats\__init__.py in <module>
465 from ._warnings_errors import (ConstantInputWarning, NearConstantInputWarning,
466 DegenerateDataWarning, FitError)
--> 467 from ._stats_py import *
468 from ._variation import variation
469 from .distributions import *
~\anaconda3\lib\site-packages\scipy\stats\_stats_py.py in <module>
35 from numpy import array, asarray, ma
36 from numpy.lib import NumpyVersion
---> 37 from numpy.testing import suppress_warnings
38
39 from scipy.spatial.distance import cdist
ModuleNotFoundError: No module named 'numpy.testing'
'''
Upvotes: 1
Views: 4564
Reputation: 1202
This cause due to the numpy version you are using. Therefore you have to downgrade your numpy version to 1.16.4
. Use following command.
sudo pip uninstall numpy
pip install numpy==1.16.4
Reference :
https://github.com/DeepLabCut/Docker4DeepLabCut2.0/issues/26
Upvotes: 2