python-docx: can't copy 'docx/templates/default-docx-template' on pip install python-docx

Hi, I’m not sure if this is the right place for posting this but, I’ve installed the package using pip install python-docx, and tried to execute the first tutorial. Then got this error:

"Package not found at '%s'" % pkg_file docx.opc.exceptions.PackageNotFoundError: Package not found at '/home/----/anaconda3/envs/myenv/lib/python3.6/site-packages/docx/templates/default-docx-template'

Then I went to the folder and there is no default-docx-template folder. I checked here on GitHub and it’s there.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

UPDATE: Short answer is to update your setuptools:

$ pip install -U setuptools

Hmm, could be a problem with the MANIFEST.ini, that directory was just added on the last release which makes me suspect. I’ll check it out here …

@RogueRaider Could you please provide setuptools version?

I was facing similar situation.

Failing on following setup

  • OS: Ubuntu 16.04
  • Python: 2.7.10 and 3.5.2
  • setuptools: 20.7.0

It worked on following setup

  • OS: MacOS
  • Python: 3.6.5
  • setuptools: 40.6.2

On ubuntu by updating setuptools pip install -U setuptools it worked.

@scanny python-docx==0.8.10 installation has missing default-docx-template directory. Is it intentional ?

@K4zuki Thank you for this input. Updating setuptools fixed my issue. I was trying to install this on ubuntu 16.04. After having some issues with updating pip, I tried a fresh linux install of mint. Still the same problem. Then I tried installing on Windows and python-docx worked with no problems.

So I knew it was something to do with linux and possibly my local config. But following your suggestion I was able to successfully install the package 😃

@scanny Thanks for your help. Appreciate your time and efforts 😃