Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Help Wanted! ModuleNotFoundError: No module named 'sklearn.cross_validation' #240

Open
marctheshark3 opened this issue Nov 10, 2018 · 4 comments

Comments

@marctheshark3
Copy link

marctheshark3 commented Nov 10, 2018

I am using most up to data Mac OS. Not sure where I am going wrong. pip and numpy are both up to date. Also when I try the command suggested:

" nosetests -v sknn "

for the test it gives me these errors:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 245, in load_module
return load_package(name, filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 217, in load_package
return _load(spec)
File "", line 684, in _load
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sknn/tests/init.py", line 1, in
from sknn.backend import lasagne
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sknn/backend/lasagne/init.py", line 5, in
from .mlp import MultiLayerPerceptronBackend
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sknn/backend/lasagne/mlp.py", line 22, in
import sklearn.cross_validation
ModuleNotFoundError: No module named 'sklearn.cross_validation'


Ran 1 test in 0.005s

FAILED (errors=2)

I also used the optional method with no luck

So if someone could help me out so I can use scikit-neuralnetwork.

Thank you!

@Matt2843
Copy link

Hi! I think that the sklearn.cross_validation module is deprecated, and replaced by the sklearn.model_selection module in the newer scikit-learn versions, you could create a pull-request after correcting this in mlp.py.

@DarquesM
Copy link

Same problem here :

ModuleNotFoundError Traceback (most recent call last)
in
----> 1 from sknn.mlp import Regressor, Layer

D:\ProgramData\Anaconda3\lib\site-packages\sknn\mlp.py in
20 import sklearn.pipeline
21 import sklearn.preprocessing
---> 22 import sklearn.cross_validation
23
24 from .nn import NeuralNetwork, Layer, Convolution, Native, ansi

ModuleNotFoundError: No module named 'sklearn.cross_validation'

@sophieclayton
Copy link

sophieclayton commented Feb 27, 2019

I have the same issue:

(soph_py3) slocum:analysis sclayton$ nosetests -v sknn
ERROR
Failure: ModuleNotFoundError (No module named 'sklearn.cross_validation') ... ERROR

======================================================================
ERROR: test suite for <module 'sknn.backend' from '/miniconda2/envs/soph_py3/lib/python3.7/site-packages/sknn/backend/init.py'>

Traceback (most recent call last):
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/nose/suite.py", line 210, in run
self.setUp()
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/nose/suite.py", line 293, in setUp
self.setupContext(ancestor)
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/nose/suite.py", line 316, in setupContext
try_run(context, names)
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/nose/util.py", line 471, in try_run
return func()
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/sknn/backend/init.py", line 24, in setup
from . import lasagne
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/sknn/backend/lasagne/init.py", line 5, in
from .mlp import MultiLayerPerceptronBackend
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/sknn/backend/lasagne/mlp.py", line 22, in
import sklearn.cross_validation
ModuleNotFoundError: No module named 'sklearn.cross_validation'

======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'sklearn.cross_validation')

Traceback (most recent call last):
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/miniconda2/envs/soph_py3/lib/python3.7/imp.py", line 244, in load_module
return load_package(name, filename)
File "/miniconda2/envs/soph_py3/lib/python3.7/imp.py", line 216, in load_package
return _load(spec)
File "", line 696, in _load
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/sknn/tests/init.py", line 1, in
from sknn.backend import lasagne
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/sknn/backend/lasagne/init.py", line 5, in
from .mlp import MultiLayerPerceptronBackend
File "/miniconda2/envs/soph_py3/lib/python3.7/site-packages/sknn/backend/lasagne/mlp.py", line 22, in
import sklearn.cross_validation
ModuleNotFoundError: No module named 'sklearn.cross_validation


Ran 1 test in 0.003s

FAILED (errors=2)

sophieclayton added a commit to sophieclayton/scikit-neuralnetwork that referenced this issue Feb 27, 2019
Updated to import sklearn.model_selection rather than sklearn.cross_validation to try to fix issue aigamedev#240
@hundanLi
Copy link

@sophieclayton It works for me. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants