8

I followed these instructions to set up GraphLab on my Ubuntu machine. At the end, I opened Python 2.7.6 and ran the first of the test lines import graphlab as gl. This gave me

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named graphlab

How can I begin to diagnose this?

Details:

I ran python -V from a terminal, and it returned me Python 2.7.6.

In /usr/bin I find the following pyth* entries ... I wonder if something somewhere pointed at the wrong version:

python     python2.7-config  python3.4   python-config
python2    python2-config    python3.4m  pythontex
python2.7  python3           python3m    pythontex3
zkurtz
  • 3,230
  • 7
  • 28
  • 64

11 Answers11

11

The Dato Graphlab Create installer did not actually install graphlab on my Mac (El Capitan). I did the following (Anaconda is installed) in a terminal window:

% pip install graphlab-create

That subsequently installed Graphlab Create. You can then easily verify:

% python
Python 2.7.10 |Continuum Analytics, Inc.| (default, Sep 15 2015, 14:29:08)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import graphlab
>>>

I've noticed that occasionally, Python will forget that Graphlab Create is installed. A repeat of the above 'pip' command will cause it to remember.

Dr. Java
  • 131
  • 1
  • 5
  • 1
    this didn't work. Can you point me to the right solution if you have come across one. – Eswar Feb 06 '19 at 09:05
5

Another option is to use virtualenvwrapper for the easy creation and application of virtual environments. For example, following this documentation, start with installation:

sudo pip install virtualenvwrapper

Open your .bashrc settings file, for example run gedit .bashrc and append the following lines to the bottom of it:

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

Restart your terminal window, and then you can make your virtual environment, say call it "test":

mkvirtualenv test

Now test is a virtual environment, and your are in it (i.e., test is "activated" currently). To put GraphLab in test,

pip install graphlab-create

Similarly, you can install other python toolkits in test by using pip, and any python program you run from within test will be able to see only the python toolkits that are installed here.

zkurtz
  • 3,230
  • 7
  • 28
  • 64
2

Maybe you should install graphlab in virtualenv.

1.Ensure your system has virtualenv installed. To verify, execute pip freeze. To install, execute sudo pip install virtualenv in your terminal before proceeding

2.Copy and execute the following commands in your terminal. This will create a virtual environment called 'graphlab' and install graphlab create version 0.9.1

virtualenv graphlab
. graphlab/bin/activate
pip install graphlab-create==0.9.1
matthias_h
  • 11,356
  • 9
  • 22
  • 40
heyuwang
  • 21
  • 2
2

You may need to activate the conda env by running

source activate dato-env

inside the terminal

Ahmed Kamal
  • 1,478
  • 14
  • 27
1

Check your system path

import sys print sys.path

It should contain graphlab-0.9.1. If not, then something was odd with our installation. I recommend using a virtual environment in python.

  • "import sys print sys.path" returns nothing when I enter that in a linux terminal ... seeking alternatives, I entered it as two separate commands in the Python console; (1) "import sys", (2) "print sys.path". I assume this is what you mean, because it returned interesting results. Indeed, none of them include "graphlab". – zkurtz Sep 27 '14 at 12:23
1

I had the same problem on ubuntu 16 desktop. The solution for me was pretty simple. After you start the notebook using

 (gl-env) davis@smeagol:~/progs/ml-foundations$ jupyter notebook

Click the file navigator to locate your notebook where you do the import graphlab which causes the error. When it starts the notebook I imagine you see |Python [Root] in the top right. To fix this, click the title bar Kernel->Change kernel->gl-env. Now the top right label should say |Python [gl-env]. Afterwards when you run the notebook import graphlab will work.

There is a tab on the intial landing page of the Jupyter UI which has Conda. In that you can see two env's named root and gl-env. I've tried to delete the root one and even though its not the default all my notebooks start up with that environment and deleting it causes an internal error.

netskink
  • 4,033
  • 2
  • 34
  • 46
1

Graphlab is not supported on python3. Install Python 2.7 as mentioned in https://conda.io/docs/user-guide/tasks/manage-python.html

0

If you don't see graphlab, simply the path of the environment is not set on "dato-env" (rather it may be set on "root")

If you use "Launcher" application, on top left set "Environment" to "dato-env".

SherWin
  • 1
  • 1
0

Well,I guess the thread is dead.

After tinkering w/ un/reinstallations a couple times, the only way I can get "import graphlab" to work reliably is to manually activate dato-env. Open your terminal and type below command

source activate dato-env

Prior to this close all the jupyter notebook. I ascertain that dato-env is in effect when my bash prompt changes to: (dato-env) pydev@smruti:~$

Now on your Jupyter notebook try to do import graphlab,this will execute without showing import error.

Hope this helps!!

PyDevSRS
  • 1,715
  • 16
  • 17
0

I had the same problems, but then I found that in the files that come along with the Machine Learning specialization (https://www.coursera.org/learn/ml-foundations/notebook/lGQH5/open-your-notebook-workspace-to-follow-along) there are some additional codes after which you don't get any errors:

import graphlab

Set product key on this computer. After running this cell, you will not need to re-enter your product key.

graphlab.product_key.set_product_key('your product key here')

Limit number of worker processes. This preserves system memory, which prevents hosted notebooks from crashing.

graphlab.set_runtime_config('GRAPHLAB_DEFAULT_NUM_PYLAMBDA_WORKERS', 4)

Output active product key.

graphlab.product_key.get_product_key()
Paul Karam
  • 4,052
  • 8
  • 30
  • 53
dimi-why
  • 1
  • 2
0

I had the same problem. I follow these steps.

1.Install Anaconda 2.7 version. Then I created vitual environment and selected python 2.7 version.

2.After create virtual environment open terminal in and run pip install notebook.

3.Then I registered https://turi.com/ because Graphlab Create requires an academic license to use.Run the following command that is given by after registration in terminal.

pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/2.1/your registered email address here/your product key here/GraphLab-Create-License.tar.gz

4.Run jupyter notebook.

5.import graphlab

6.Then I got an error.So i run graphlab.get_dependancies() command. After that restarted the kernel.

7.After above all steps I typed import graphlab again.

8.It executed without errors.