[IronPython] Cannot import 'Networkx' into Ironpython

Jeff Hardy jdhardy at gmail.com
Tue Jan 25 16:54:55 CET 2011


It looks like networkx is a pure-Python package, so it should work.
What are you adding sys.path? I cloned the repo into the networkx
folder, which contains a networkx folder - sys.path should point to
the outer folder.

>>> sys.path.append(r'C:\Users\<user>\Documents\Repositories\networkx')

Doing that, it complains that it can't find subprocess, which is a bug
in the alpha - I'm not sure it's fixed in B1, but it will be in B2. In
the meantime you can copy subprocess.py from
https://github.com/IronLanguages/main/blob/master/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/subprocess.py
into the Lib folder for your IronPython installation.

- Jeff

On Tue, Jan 25, 2011 at 8:31 AM, Federico Vaggi <vaggi at cosbi.eu> wrote:
>  Hello,
>
> I am a very new user to Ironpython, so hopefully I am not missing anything
> obvious.  I read the FAQ and searched the Ironpython site and I couldn't
> find a solution to the problem I was having.
>
> I have installed both CPython 2.7 and Ironpython 2.7 (the alpha version) and
> I am interested in using the networkx library (http://networkx.lanl.gov/)
> under Ironpython.
>
> I installed networkx here:
>
> C:\Python27\Lib\site-packages\networkx
>
> using the cpython interpreter, the installation worked fine:
>
>>>> import networkx as nx
>>>> G=nx.Graph()
>>>> G
> <networkx.classes.graph.Graph object at 0x02C04250>
>
> if I try to use the ironpython interpreter:
>
> I get a:
> File "<stdin>", line 1, in <module>
> ImportError: No module named networkx
>
> I tried manually adding the site.py file, to add networkx manually to the
> path, but even after adding it (and checking that it shows up in
> system.path) ironpython still doesn't see it.
>
> Anyone have useful advice here?
>
> Thank you very much,
>
> Federico
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



More information about the Ironpython-users mailing list