Install Python library without pip


I’m new to Python, so please bare with me. I would like to use python-docx within Dynamo to be able (or try) to write to a Word document.
I went on the website for it and it explains how to install it using pip install but I don’t know how that works in IronPython through Dynamo or if it’s possible to use in Dynamo.
I’ve installed python-docx and lxml (a dependency) in a local folder but I don’t know how to access it.

So far I’ve tried this code but it can’t seem to get the library.

import clr
import sys
sys.path.append(r’[local path where python-docx is installed]’)

Is there something I’m missing when it comes to Python packages? Does it need to be put in a specific spot?

Any help is appreciated!


In general, don’t use anything not supported by IronPython 2.7.3 out of the box. You cant ensure that others have the same packages as you have. That version doesn’t support pip.
It looks unfortunately also to be the same outdated version of IronPython that will continue in Dynamo 2.0

I had hoped that ‘pythonnet’ (in a Python 3.6 version) could have been implemented instead, but that doesn’t seem to be the case (

If you place you downloaded python package in the lib folder (IronPython) and it has the --init–.py file, then should you be able to implement it using the normal path to IronPython… and obviously also only if your package support that version of Python!

Below is another way of implementing sys.path, by using insert you ensure that the path to IronPython is the primary path.

import sys
sys.path.insert(0, 'C:\Program Files (x86)\IronPython 2.7\Lib')

You can run external commands like scripts or executables from Dynamo. You can parse your data from Revit to Dynamo and then run a Python script from outside Revit and Dynamo. You can run Python with every library you need and both Python 2.x and 3.x
Take a look at this.

How will you run Python 3 syntax?

That is not possible to my knowledge

And as written, including packages not an OOTB package will give problems when it has to run on another computer. But as written, yes is is doable… My own package is coded as a OOP environment based on external files where I have created my package as a python library.

A Python script from inside Dynamo can run any arbitrary external command. You can run any shell script or executable. There’s no problem in installing stand alone Python 3.x or whatever version docx library needs and run external Python script within that environment.

To wrap up.

  1. Install stand alone Python.
  2. Install all required libraries.
  3. Create a .py script on your computer.
  4. Call your script from Dynamo
  • I don’t know if OP works alone or in corporate environment. His problem is solvable but not sustainable.
1 Like

Do you have any example where that is done? I would be very interested to see that. I would also prefer to be able to run python 3.6… so please show some example.

I am considering how I could implement pythonnet in a zerotouch node, just to be able to code in python 3.6 and be able to use pip. So if you know a workaround, please share :slight_smile:

Yes, it seems this package is supported with IronPython 2.7.3. I made sure of that.
The thing is I have the package downloaded and unzipped, but how do I use the to install the package and get the file?
I probably should’ve included that in the original post.
Also, I’m in an office and would like to put it in a shared drive location that other people could access. Does it have to go C:\Program Files (x86)\IronPython 2.7\Lib?
Thanks so much for the help!

You can place it anywhere… just give a path to it
As mentioned earlier I have implemented my package as an OOP environment. This means that you could place the python package inside your own package and by doing this you can “ensure” other users to have what is needed. Again implemented with a path, which I have done by reading a binary file in the bin folder.


Okay I see what you mean then. That’s convenient!
I guess it’s the package download that’s confusing me. After unzipping the package, it gave me a folder with the name of the package and, but I don’t know if that’s the actual package.
Do I run the somehow or place that in that folder?
How do I run that? Is that done through IronPython? Does that make sense?

have you installed a native Python? please install 2.7.14 (x64) it supports pip, then follow

by that you will have the package installed in the native Python folder… copy what you need to the shared location or whatever solution you prefer, then you can load the modules in that package as you please :slight_smile:

1 Like

Okay that’s what I needed. I didn’t realize I’d have to install Python, I figured I could go through IronPython but this sounds like a more straight-forward route. I’ll give it a try. Thank you so much! :smiley:

Below is there a how-to guide for using external IDE, that involves a native Python installation… I will strongly recommend everyone to use external IDE if they want to work with python.

1 Like

It’s just a proof of concept.

This is Dynamo graph

This is Python code in Dynamo:

import clr
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import os
arg = IN[0]
os.system('python z:\ ' + arg)

You can also use subprocess for more control.

And this is

import sys
print('Number of arguments:', len(sys.argv), 'arguments.')
print('Argument List:', str(sys.argv))
input('Press Enter to continue...')

This is the outcome:



So you have to call it and let it run in a command shell? that is not optimal…

I agree that it is problematic that we only have IronPython (2.7.3) and we don’t have pip. But for now, it seems best to stick with Python 2.7 syntax since that be run inside dynamo.

However, I really don’t understand why the dynamo team doesnt try to implement pythonnet instead and let us use python 3.6 and pip… I don’t understand why they stick to IronPython (in an outdated version)

You can also use subprocess which more flexible.
This code is from my first link.

from System.Diagnostics import Process
path = r"C:\somepath"
myfile = "somefile.docx"
command = "%s\\%s"% (path,myfile)

proc = Process()
proc.StartInfo.FileName = command

It’s not optimal but it gets work done.

And that’s the reason they stick with 2.7

That’s why I have considered if it could be doable to implement pythonnet in my own zerotouch nodes…
I would also like to be able to implement other languages, example C# scripts, since there is so much help available for Revit in that language. I think also that being able to read TypeScript could be interesting.

Imagine if we could involve Jeremy Tammik here (

Thanks @Tomasz for some good ideas. If I run into something I miss from py3.6 I will try your methods :slight_smile:

Fairly certain that you could also call on the MS word API directly via Python - no add ins required, just need word installed.

I believe that this is hkw the bumblebee package accesses MS Excel.

Hi @JacobSmall,
I just tried doing that just now and made a separate forum post about it. Trying to get that to work as well. Replace Word text using Interop