# Openpyxl module

**URL:** <https://forum.dynamobim.com/t/openpyxl-module/94081>\
**Category:** Developers\
**Tags:** revit, excel, python, dynamo\
**Created:** [September 27, 2023, 10:09am UTC](https://forum.dynamobim.com/t/openpyxl-module/94081 "2023-09-27T10:09:45Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [September 28, 2023, 9:21am UTC](https://forum.dynamobim.com/t/openpyxl-module/94081/5 "2023-09-28T09:21:39Z")

</div>

It looks like you have it installed on a python instance (3.11) that is not being used by Dynamo  
You can find the install location `OUT = sys.path` which will return a few paths

```python
C:\Users\<username>\AppData\Local\python-3.8.3-embed-amd64\python38.zip,
C:\Users\<username>\AppData\Local\python-3.8.3-embed-amd64,
C:\Users\<username>\AppData\Local\python-3.8.3-embed-amd64\lib\site-packages

```

`pip` is not always the easiest module to install with Dynamo  
Try this in a Python node with CPython3

```python
import subprocess
import sysconfig
from pathlib import Path # python3 library

# Get file / exe locations for running Python install
pypath = Path(sysconfig.get_path("data")) # root path to python install
pyexe = pypath / "python.exe"
pipexe = pypath / "Scripts/pip.exe"

def getpip():
    """Install pip from the internets"""
    if pipexe.exists():
        return f"Pip already installed at {str(pipexe)}"
    # Fingers crossed the enterprise firewall lets this through
    comm = ["curl", "https://bootstrap.pypa.io/get-pip.py", "|", pyexe, "-"]
    return subprocess.run(comm, capture_output=True, shell=True)

OUT = getpip()

```

You may have to reload the Dynamo graph to get access to `pip`, you may also have to uncomment the `import site` line in the _python\<version\>.\_pth_ file (e.g. _python38.\_pth_) located in the python root folder (`pypath` above)

Then you can install from a list or string of module names with a function something like this

```python
def install(package):
    comm = [pyexe, "-m", "pip", "install"]
  
    if isinstance(package, str):
        comm += package.split()
    elif isinstance(package, list):
        comm += package
    else:
        raise TypeError("Input is not string or list of python modules")

    return subprocess.run(comm, capture_output=True, shell=True)
```

---

_[View the full topic](https://forum.dynamobim.com/t/openpyxl-module/94081)._
