title: Python 2.7 - No module named expat; use SimpleXMLTreeBuilder instead - source code install
body: <p>I'm working on a server that doesn't allow Python installs (pip, easy_install), so I have to place the source code into a local directory to get Python + openpyxl running.</p>
  
  <p>I have Python2.7 and openpyxl-2.5.8 available, as well as openpyxl dependencies.  However, when openpyxl calls builtins.py, I get the </p>
  
  <pre><code>ImportError: No module named expat; use SimpleXMLTreeBuilder instead
  </code></pre>
  
  <p>expat.py is available in python2.7/Lib/xml/parsers, but I assume due to the the way Python was 'installed' it can't recognize something, possibly related to C extensions (based on <a href="https://groups.google.com/forum/#!topic/google-appengine/tzmakclSXJc" rel="nofollow noreferrer">https://groups.google.com/forum/#!topic/google-appengine/tzmakclSXJc</a>). </p>
  
  <p>Per @thom_nic's advice at <a href="https://stackoverflow.com/a/2067177">https://stackoverflow.com/a/2067177</a>, I got the old source code for elementtree and tried pointing XMLTreeBuilder in ElementTree to the SimpleXMLTreeBuilder as:</p>
  
  <pre><code>from xml.etree import ElementTree
  from elementtree import SimpleXMLTreeBuilder 
  ElementTree.XMLTreeBuilder = SimpleXMLTreeBuilder.TreeBuilder 
  </code></pre>
  
  <p>However, I still get the same error.  Full traceback below for reference.  Any ideas on how to get around this, since I can't reinstall Python or run <code>yum update</code> or anything like that?</p>
  
  <p>Traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/python_packages/python2.7/Lib/runpy.py", line 174, in _run_module_as_main
      "__main__", fname, loader, pkg_name)
    File "/home/python_packages/python2.7/Lib/runpy.py", line 72, in _run_code
      exec code in run_globals
    File "/home/release/create_sheet.py", line 18, in &lt;module&gt;
      from openpyxl.workbook import Workbook
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/__init__.py", line 6, in &lt;module&gt;
      from openpyxl.workbook import Workbook
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/workbook/__init__.py", line 5, in &lt;module&gt;
      from .workbook import Workbook
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/workbook/workbook.py", line 7, in &lt;module&gt;
      from openpyxl.worksheet import Worksheet
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/worksheet/__init__.py", line 4, in &lt;module&gt;
      from .worksheet import Worksheet
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/worksheet/worksheet.py", line 35, in &lt;module&gt;
      from openpyxl.cell import Cell
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/cell/__init__.py", line 4, in &lt;module&gt;
      from .cell import Cell, WriteOnlyCell
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/cell/cell.py", line 46, in &lt;module&gt;
      from openpyxl.styles.styleable import StyleableObject
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/styles/styleable.py", line 11, in &lt;module&gt;
      from .builtins import styles
    File "/home/python_packages/openpyxl-2.5.8/openpyxl/styles/builtins.py", line 1350, in &lt;module&gt;
      ('Normal', NamedStyle.from_tree(fromstring(normal))),
    File "/home/python_packages/python2.7/Lib/xml/etree/ElementTree.py", line 1310, in XML
      parser = XMLParser(target=TreeBuilder())
    File "/home/python_packages/python2.7/Lib/xml/etree/ElementTree.py", line 1482, in __init__
      "No module named expat; use SimpleXMLTreeBuilder instead"
  ImportError: No module named expat; use SimpleXMLTreeBuilder instead
  </code></pre>