Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named learn.base #105

Open
JayForest opened this issue Apr 16, 2015 · 12 comments
Open

ImportError: No module named learn.base #105

JayForest opened this issue Apr 16, 2015 · 12 comments

Comments

@JayForest
Copy link

hi,I start to learn to study the crab using python ,but I come across some problems, my example's code is

author = 'Cookie'
from scikits.crab import datasets
movies = datasets.load_sample_movies()
songs = datasets.load_sample_songs()

print(movies.data)

print(songs)
from scikits.crab.models import MatrixPreferenceDataModel
#Build the model
model = MatrixPreferenceDataModel(movies.data)
from scikits.crab.metrics import pearson_correlation
from scikits.crab.similarities import UserSimilarity

Build the similarity

similarity = UserSimilarity(model, pearson_correlation)

from scikits.crab.recommenders.knn import UserBasedRecommender

problems:
Traceback (most recent call last):
File "D:/Rail/jx/Python/project1/Crab.py", line 16, in
from scikits.crab.recommenders.knn import UserBasedRecommender
File "D:\Program Files (x86)\Python27\lib\site-packages\scikits\crab\recommenders\knn__init__.py", line 1, in
from .classes import ItemBasedRecommender, UserBasedRecommender
File "D:\Program Files (x86)\Python27\lib\site-packages\scikits\crab\recommenders\knn\classes.py", line 17, in
from base import ItemRecommender, UserRecommender
File "D:\Program Files (x86)\Python27\lib\site-packages\scikits\crab\recommenders\knn\base.py", line 17, in
from ..base import MemoryBasedRecommender
File "D:\Program Files (x86)\Python27\lib\site-packages\scikits\crab\recommenders\base.py", line 17, in
from ..base import BaseRecommender
File "D:\Program Files (x86)\Python27\lib\site-packages\scikits\crab\base.py", line 11, in
from scikits.learn.base import BaseEstimator
ImportError: No module named learn.base

I had installed the packages:Python 2.7.9, numpy-MKL-1.8.0.win-amd64-py2.7,scipy-0.15.1-cp27-none-win_amd64,matplotlib-1.4.3.win-amd64-py2.7,scikit-learn-0.16.1.win-amd64-py2.7,thank you very much.

@JoannaMisztalRadecka
Copy link

I had the same problem, but I fixed it after installing scikits-learn on Ubuntu according to instructions from http://scikit-learn.org/stable/install.html, I had to change the import from:

from scikits.learn.base import BaseEstimator

to:

from sklearn.base import BaseEstimator

@psneog
Copy link

psneog commented Sep 1, 2015

I am facing the same problem on windows. Somebody help me please.

@Lawrence-Liu
Copy link

@IIUJ-JoannaMisztal is right about this. This project is toooooo old, back then scikit-learn was called scikits.learn. So you need to update the code and recompile it yourself.

@psneog
Copy link

psneog commented Sep 2, 2015

I have installed the canopy python distribution and the program started working!

@HuihuangZhang
Copy link

According to Installing Crab, you should install scikits.learn. However, from scikit-learn_doc

Warning As of version 0.9 (released in September 2011), the import path for scikit-learn has changed from scikits.learn to sklearn

so maybe the author should update the source code!

@GizemEce
Copy link

Hello,
I tried all the things you listed but i am still getting error while i am importing "from crab.recommenders.knn import UserBasedRecommender". And 3 months ago i correct it as " from scikits.crab.recommenders.knn.classes import UserBasedRecommender" and it worked but now it does not work? Does anyone have problems with it currently and know how to fix it?

@Izzy4me
Copy link

Izzy4me commented Mar 19, 2016

So... anyone has an experience what i really needs to refactor for newest version of scikits to work properly? Or i should use the old one? I know project is old, but my tutor adviced it for my, to do simply recomendation system module and now it is not funny -.-

@imqianyi
Copy link

  1. install pip install -U scikit-learn.
  2. fix the code scikits.learn.base to sklearn.base

zareenfarooqui added a commit to zareenfarooqui/crab that referenced this issue Apr 17, 2016
zareenfarooqui added a commit to zareenfarooqui/crab that referenced this issue Apr 17, 2016
Changed import library

muricoca#105
@rmf770609
Copy link

Hi, I’ve changed “scikits.learn.base” to “sklearn.base” both
@ scikits/crab/base.py
@ scikits/crab/metrics/classes.py

And I still got problem with
“from scikits.crab.recommenders.knn import UserBasedRecommender”
by ImportError: No module named base

Is there anything I did wrong?

@DerekAI
Copy link

DerekAI commented May 24, 2016

I have made following change in the source code:

#from scikits.learn.base import BaseEstimator
from sklearn.base import BaseEstimator

then reinstall crab using the following command in crab directory

python setup.py install

Now, it seems to be more health.

@finlay-liu
Copy link

I find it can clone the source code and install by source code. It will be ok.

@benadaba
Copy link

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

No branches or pull requests