Calling networkx in R

549 views
Skip to first unread message

Song April

unread,
Nov 18, 2020, 9:56:57 PM11/18/20
to networkx-discuss
Hi,

Has anyone used networkx in R yet? I used library(reticulate) to call python packages in R and got it worked out with several packages such as numpy. 

But when I tried to import networkx from python, it returns:

Error in py_module_import(module, convert = convert) : 
  ImportError: No module named networkx

I wonder if I made a mistake or networkx is not able to be called to R.

Any suggestions would be highly appreciated.

Dan Schult

unread,
Nov 18, 2020, 9:59:02 PM11/18/20
to networkx...@googlegroups.com
It sounds like R can't find the software. 
Did you install networkx in a way that R can find it (i.e. the same way you did to get numpy working)?
Any difference there?

Song April

unread,
Nov 18, 2020, 10:01:48 PM11/18/20
to networkx-discuss
thanks for your quick response. 

I believe so. I could use networkx the same way in python as I did with other packages like numpy.

Could not figure out where went wrong.

Dan Schult

unread,
Nov 18, 2020, 10:04:55 PM11/18/20
to networkx...@googlegroups.com
Yes, there is nothing in networkx that would make this not work. 
It should work the same way as the other python packages.
Installing it in a way that R can find it is the key to making it work.
Sometimes you have more than one version of Python installed
and the one R calls isn't the one you installed networkx on.


--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/d495124e-ecbf-416d-854e-e595cc3e98fbn%40googlegroups.com.

Song April

unread,
Nov 18, 2020, 10:06:23 PM11/18/20
to networkx-discuss
That makes sense to me. Any idea how to check that out?

Dan Schult

unread,
Nov 18, 2020, 10:12:42 PM11/18/20
to networkx...@googlegroups.com
Sorry.... I've used R from Python but not the other way around.  Maybe someone else has an idea --




Song April

unread,
Nov 18, 2020, 10:13:23 PM11/18/20
to networkx-discuss
No problem. Thanks for your help anyway.

Song April

unread,
Nov 28, 2020, 10:13:50 PM11/28/20
to networkx-discuss
I finally found the solution for this problem. Just in case anyone run into the same issue, this would be of help:

Reply all
Reply to author
Forward
0 new messages