Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GraphLab Create "ImportError: No module named graphlab"

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
like image 870
zkurtz Avatar asked Sep 21 '14 14:09

zkurtz


4 Answers

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.

python anaconda graphlab

like image 125
Dr. Java Avatar answered Nov 15 '22 09:11

Dr. Java


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.

like image 25
zkurtz Avatar answered Nov 15 '22 08:11

zkurtz


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
like image 2
heyuwang Avatar answered Nov 15 '22 09:11

heyuwang


You may need to activate the conda env by running

source activate dato-env

inside the terminal

like image 2
Ahmed Kamal Avatar answered Nov 15 '22 07:11

Ahmed Kamal