Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in python-igraph 'module' object has no attribute 'Graph'

I have installed igraph on Pycharm for Windows.

import igraph

yields no errors.

import igraph
print igraph.__version__

yields: 0.1.5.

import igraph
dir(igraph)

yields nothing...

import igraph
g = igraph.Graph(1)

yields:

Traceback (most recent call last):
File "C:/Users/Margaret/PycharmProjects/untitled/trial.py", line 2, in g = igraph.Graph(1)
AttributeError: 'module' object has no attribute 'Graph'

Does anyone know what the issue might be? I've looked at all the previously asked questions I could find and I haven't found an answer that will work for my case. Thanks.

like image 289
Margaret McDaniel Avatar asked Mar 20 '15 05:03

Margaret McDaniel


1 Answers

There are two igraph libraries on PyPI, igraph and python-igraph.

You have igraph installed, which is the wrong one. Uninstall it using:

pip uninstall igraph

As you are on Windows you probably need a pre-compiled distribution, called a wheel.

This site has lots of wheels which can be installed using pip. Here is the wheel for python-igraph.

Install using, e.g.:

pip install python_igraph-0.7.1.post4-cp27-none-win32.whl
like image 158
Peter Wood Avatar answered Oct 18 '22 18:10

Peter Wood