pythonimportgraphlab

About Graphlab library importing


In Ubuntu 14.04, I have installed Graphlab based on https://dato.com/download/install-graphlab-create-command-line.html and it seems to be working fine.

However, I receive this error when trying to use a recommender module:

import graphlab 
from graphlab.recommender import ranking_factorization_recommender

In the first line, graphlab is imported without any error. However, the second line causes this error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last) 
<ipython-input-5-34df81ffb957> in <module>()
----> 1 from graphlab.recommender import ranking_factorization_recommender

ImportError: No module named recommender

How can the problem be solved? Thanks


Solution

  • It's just a namespace issue. recommender actually lives in the `toolkits module, so this should work:

    import graphlab
    from graphlab.toolkits.recommender import ranking_factorization_recommender