9
votes

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.

1
I don't know much about the version history of igraph, but with 0.7.1, your code works as you expected. Is it possible to update?jedwards
So the installation didn't go well... to me dir(igraph) returns a bunch of stuff.Nir Alfasi
Did you install it by running: pip install python-igraph ? or pip install igraph ? you should use the former! in case you ran the latter, it will seem to be installed but it's messed up...Nir Alfasi
Are those examples meant to be in the console? If not, you need to print dir(igraph).Peter Wood
@alfasin That's it exactly. There are two different packages. pip install python-igraphPeter Wood

1 Answers

13
votes

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