ModuleNotFoundError: No module named 'numpy.testing.nosetester' ModuleNotFoundError: No module named 'numpy.testing.nosetester' numpy numpy

ModuleNotFoundError: No module named 'numpy.testing.nosetester'


This is happening due to a version incompatibility between numpy and scipy. numpy in its latest versions have deprecated numpy.testing.nosetester.

Replicating the issue

pip install numpy==1.18 # > 1.18pip install scipy<=0.19.0 # <= 0.19 

and

from sklearn.tree import DecisionTreeClassifier as DTC

Triggers the error.

Fixing the error

Upgrade your scipy to a higher version.

pip install numpy==1.18pip install scipy==1.1.0pip install scikit-learn==0.21.3

But not limited to this. By upgrading the above libraries to the latest stable, you should be able to get rid of this error.


I needed to upgrade scipy

pip3 install -U scipy


I was facing the same error while using lexnlp package Got it fixed by installing:

scipy==1.4.1pandas==0.23.4    numpy==1.18.1lexnlp==0.2.7.1 

(Only install lexnlp if know you're explicitly using it in your project and you know what you're doing)