0

I would love to use python-docx, but it is only available as a .wheel, and requires PIP to install.

For security reasons, our PCs are locked down tight and we can't install. There is also something else going on with the firewall, because I finally figured out that I could use

python.exe" -m pip install -U pip wheel docx

but that timed out, so I imagine that they are blocking certain kinds of traffic.

Since a .wheel file is just a .zip with different extension, I could rename it and extract the files, but I don't know where to copy them to, plus there are the dependencies (lxml, which, in turn, has its own dependencies).

So far, this reads like a question for another site, and maybe it will become one. Right now, I just want a Python library, preferably a single file, with instructions to say where to copy it (some central Python directory, or the directory of the script that uses it), so that I can import <library> and use it to read/write MS word files (2103 and later).

1
+200

As you can read there on the official docs you can install it without using pip.

  1. Download python-docx latest version from here
  2. Extract it using 7zip or your favorite tool
  3. cd python-docx-{version}
  4. python setup.py install

But you need to make sure the dependencies are met, therefore you need to install first lxml. I assume youre using windows, you can find prebuild binaries of lxml here.

I know you wrote you cant install things, but your question reads more like youre not able to cant download files through pip.

I havent tested this, but this should lead you to the correct direction

EDIT:

I just found out, that there are actually prebuild python wheels available for lxml here. You need to download the one, appropriate to your environment (in my case it was lxml‑4.2.5‑cp37‑cp37m‑win32.whl - I have python 3.7 installed).

  • Afterwards copy it to somwhere
  • Install it using pip: pip install C:/dev/pythonTest/lxml-4.2.5-cp37-cp37m-win32.whl
  • Follow 1-4 from above

After doing this steps, I was able to use python-docx.

  • 1
    Thanks a 1,000,000. That ought to do it. We can't install, as in run a standard setup.exxe, and definitely can't do anything that writes to the registry, but I reckon this ought to be doable. Thanks again! – Mawg Nov 10 '18 at 8:47
  • 1
    Do you have pip installed? I know you cant install from internet, but do you have it installed? EDIT: I have updated my answer. Give it a try – Joker Nov 12 '18 at 8:55
  • 1
    Thanks a 1,000,000. I found a pip.tgz and managed to install it. – Mawg Nov 12 '18 at 9:14
  • 1
    Its also bundled usually with the latest python installation :) Glad it worked out for you! – Joker Nov 12 '18 at 9:15
  • 1
    Yaya!! It workzes! I have opened a 200 point bounty which I can't award for 23 hours. Rest assured that you will receive it then :-) Thanks a 1,000,000 for your help, and for your patience – Mawg Nov 12 '18 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.