1

I'm trying to install python-docx so I typed in the cmd

easy_install python-docx

and got:

Searching for python-docx
Best match: python-docx 0.7.4
Processing python_docx-0.7.4-py2.6.egg
python-docx 0.7.4 is already the active version in easy-install.pth

Using c:\python26\lib\site-packages\python_docx-0.7.4-py2.6.egg
Processing dependencies for python-docx
Finished processing dependencies for python-docx

but when I open python and type:

import docx

I got:

 File "c:\python26\lib\site-packages\docx-0.2.4-py2.6.egg\docx.py", line 17, in <
module>
    from lxml import etree
ImportError: DLL load failed: The specified procedure could not be found.

How can I solve this import error? what is missing?

4
  • May be you need this "pypi.python.org/pypi/lxml/3.2.3" Commented Oct 16, 2014 at 12:20
  • I got Searching for lxml Best match: lxml 3.4.0 Processing lxml-3.4.0-py2.6-win-amd64.egg lxml 3.4.0 is already the active version in easy-install.pth Using c:\python26\lib\site-packages\lxml-3.4.0-py2.6-win-amd64.egg Processing dependencies for lxml Finished processing dependencies for lxml and again the same error. Commented Oct 16, 2014 at 12:21
  • Can you import a module of docx like from docx import Document? Commented Oct 16, 2014 at 12:40
  • Checked it now and possibly no. Commented Oct 16, 2014 at 12:56

2 Answers 2

2

This symptom can arise when you have both a legacy version and a new version of python-docx installed. I recommend you uninstall both completely and then install python-docx using pip. In general I recommend avoiding the use of easy_install anymore.

The legacy versions (v0.2.x) have the install-package name 'docx'. The new version uses the name 'python-docx' (although both import as 'docx' once installed). If you installed with pip doing the uninstall/reinstall would look something like this:

$ pip freeze
...
docx
...
python-docx
...

$ pip uninstall docx
...
$ pip uninstall python-docx
...
$ pip install python-docx
...

It sounds like you used easy_install originally, so you might need to uninstall manually, although I would try first and see if pip will get it done for you. If not, a quick search on python easy_install uninstall will lead you to useful resources. It might involve visiting "c:\python26\lib\site-packages\" and removing any files or directories that start with 'docx' or 'python-docx'.

This should get you further along. If it still gives you trouble after doing this, let me know the new symptoms. You should be able to install pretty transparently on an uncorrupted Python installation if you use pip.

Sign up to request clarification or add additional context in comments.

9 Comments

Now I'm getting the erorr: Downloading/unpacking python-docx Could not fetch URL https://pypi.python.org/simple/python-docx/: There was a p roblem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:480: erro r:0D0C50A1:asn1 encoding routines:ASN1_item_verify:unknown message digest algori thm> Will skip URL https://pypi.python.org/simple/python-docx/ when looking for dow nload links for python-docx
Could not fetch URL https://pypi.python.org/simple/: There was a problem confi rming the ssl certificate: <urlopen error [Errno 1] _ssl.c:480: error:0D0C50A1:asn1 encoding routines:ASN1_item_verify:unknown message digest algorithm> Will skip URL https://pypi.python.org/simple/ when looking for download links for python-docx Cannot fetch index base URL https://pypi.python.org/simple/ Could not fetch URL https://pypi.python.org/simple/python-docx/: There was a p
roblem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:480: erro r:0D0C50A1:asn1 encoding routines:ASN1_item_verify:unknown message digest algori thm> Will skip URL https://pypi.python.org/simple/python-docx/ when looking for dow nload links for python-docx Could not find any downloads that satisfy the requirement python-docx Cleaning up... No distributions at all found for python-docx Storing complete log in C:\Users\Nir\pip\pip.log
Sounds like you're having trouble with your network connection or something. You can see the files it's looking for here on PyPI: pypi.python.org/simple/python-docx
My network connection is functioning. pip still gives me this error and suppose I use easy_install I get the same error while importing import python-docx (etree again couldn't be found)
|
0

I too was getting same 'DLL load failed' error. Stupid mistake on my part, but had installed 32 bit Python on to 64 bit Windows. Un-installed 32 bit version, installed 64 bit version - problem sorted.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.