Explenation of adding extra libraries to GH-Python standard content


I want to install some extra libraries to my GH-Python. Some websites support direct downloads, some offers just codeblocks. Is there anywhere a special folder like the plug-in folgerf or GH? What is Pip and is it part of the standard pre-installed python content in GH?
Where is the GH-Python-Language stored?

Maybe someone can explain the hole structure of adding modules/libraries (same?) to Python?

Thanks a lot!

Have a look at this thread and this one.

1 Like

I already read these two posts. The thing is, that I am not sure what exactly defines the module? I went to https://github.com/networkx/networkx and downloaded the hole thing. Then I importet in Rhino like you recommended in the first post.

Here is the import

Then I tried to call the module in GH-Python with " import networkx " but I get the error that the module does not exist.

One more question. Let’s say I want to share to Code with another person, that has not installed the module I am calling in my script. Is there any way to “internalise” the module? What is the best way to work with that.

Networkx requires Python 3.5 or greater
https://github.com/networkx/networkx/blob/master/INSTALL.rst probably CPython only.
Rhino and gh use Ironpython 2.7 so i’m Afraid you can’t use this or indeed most scientific libraries with Rhino and GH
If you delete the final networkx from your added search path then GH should see it and throw errors because it is not compatible

1 Like

Did you see this post, you need to extract the folder named networkx and place this in a path that is readable by the Rhino Python interpreter (i.e. by adding it to the module search paths, or directly in the code itself). Have attached networkx 1.5, which will (mostly) work with the IronPython version used by Rhino. If you unzip this to a folder in the module search paths and restart Rhino, you should be good to go.

networkx.zip (414.0 KB)

Edit: Here’s the archived version, for full context:


Edit II: Of course it’s a real shame that versions beyond 1.5 do not (yet) play nice with IronPython. But I’ve used it quite a lot for many different things, and have yet to find a better (in terms of features, versatility and simplicity) graph library for use with GHPython (including QuickGraph). Also note that you can “patch” it, by copying functions from future versions over and implementing these directly.


Thanks a lot. There was the problem with the compatibility! Version 1.5 worked for me, thanks a lot!

Please also have a look on my question of “how to share” code when my sharing-partner hasn’t installed the extra module I used in my script.

I tend to ship along a dependencies archive for Python modules, and have the user unzip this to e.g.:


Same for .dlls/.ghas to:


This is hardly the best solution, but it is very simple and highly explicit. Which in my experience is often better than automagic. I know that @will has been working on automating issuing of dependencies (i.e. with Yak), but I’m not sure if this support Python modules yet.

So the consequence is, that you are organizing and storing your modules in the pre-setted scripts folder, that rhino gives you?

It depends: I don’t really like to dictate how people structure their modules/libraries, but when issuing to “nOObz” I generally recommend that they use the existing/hard-coded Rhino scripts folder (to avoid having to explain the whole EditPythonScript editor module paths workflow, first thing). I personally use a folder that is synced to my Dropbox, so I always have the same mirror of all my modules on all the systems I work on.

1 Like

Good idea to use synchronized folders, but there is the problem of acutualizing the path, when chaning the device you are working on. For example:

Path0 = C:\Users\student_f\Dropbox…\scripts
Path1 = C:\Users\OfficeStation21\Dropbox…\scripts

So for most people the path would change when switching the device. ´´
One more option would be to add both paths to the searching paths list, is that correct?

The path is manually entered on each device as you showed above.
You can find the home path programmatically in python with os.path.expanduser("~")
It is apparently possible to find the dropbox path as well!

1 Like


Thanks a lot for your time guys!

1 Like