Fail import python module in grasshopper

Hi all,
I’m trying to use networkx module in GH python. I’ve added the source path in python editor, and the sys.path also shows the correct local folder. Somehow, it still fails to import the networkx module.

002

IronPython version is 2.7.5
Rhino5 SR13

Regards,
Shaun

Could be that you didn’t unpack/unzip/install the networkx module properly, I wrote a bit about this here that might help. You can also try moving the module to the default Rhino script folder* to help troubleshoot/rule out potential path issues. Also note that networkx version beyond 1.5 may not work with IronPython.

*C:\Users\USERNAME\AppData\Roaming\McNeel\Rhinoceros\5.0\scripts

2 Likes

Hi Anders,

You save my day. Once I download networkx1.5 and place in Rhino script folder, everything works very well! Just out of curiosity, I still don’t get it why gh python doesn’t recognize the indicated path.

Thanks for your help.
Shaun

Any path that you have added using this method should work with GHPython as well:

If not, something might be broken with your setup and we would need to investigate further.

Glad it helped :wink:

I did follow your procedure to place networkx at the beginning. And that’s why I thought GH python suppose to find the folder but it doesn’t. :confused: