skip to Main Content

I’m trying to install python-docx on CentOS 7 – i’ve installed it fine on the vagrant box running CentOS 7 but on my live cpanel server i’m just getting all the following issues:

pip install python-docx
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting python-docx
  Using cached python-docx-0.8.10.tar.gz (5.5 MB)
Requirement already satisfied: lxml>=2.3.2 in /usr/lib64/python2.7/site-packages (from python-docx) (3.2.1)
Using legacy setup.py install for python-docx, since package 'wheel' is not installed.
Installing collected packages: python-docx
    Running setup.py install for python-docx ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vbrTnn/python-docx/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vbrTnn/python-docx/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_hd1wy/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python2.7/python-docx
         cwd: /tmp/pip-install-vbrTnn/python-docx/
    Complete output (105 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/docx
    copying docx/blkcntnr.py -> build/lib/docx
    copying docx/shared.py -> build/lib/docx
    copying docx/section.py -> build/lib/docx
    copying docx/shape.py -> build/lib/docx
    copying docx/settings.py -> build/lib/docx
    copying docx/document.py -> build/lib/docx
    copying docx/table.py -> build/lib/docx
    copying docx/__init__.py -> build/lib/docx
    copying docx/compat.py -> build/lib/docx
    copying docx/exceptions.py -> build/lib/docx
    copying docx/package.py -> build/lib/docx
    copying docx/api.py -> build/lib/docx
    creating build/lib/docx/styles
    copying docx/styles/styles.py -> build/lib/docx/styles
    copying docx/styles/__init__.py -> build/lib/docx/styles
    copying docx/styles/style.py -> build/lib/docx/styles
    copying docx/styles/latent.py -> build/lib/docx/styles
    creating build/lib/docx/image
    copying docx/image/bmp.py -> build/lib/docx/image
    copying docx/image/constants.py -> build/lib/docx/image
    copying docx/image/jpeg.py -> build/lib/docx/image
    copying docx/image/tiff.py -> build/lib/docx/image
    copying docx/image/image.py -> build/lib/docx/image
    copying docx/image/__init__.py -> build/lib/docx/image
    copying docx/image/exceptions.py -> build/lib/docx/image
    copying docx/image/png.py -> build/lib/docx/image
    copying docx/image/gif.py -> build/lib/docx/image
    copying docx/image/helpers.py -> build/lib/docx/image
    creating build/lib/docx/opc
    copying docx/opc/oxml.py -> build/lib/docx/opc
    copying docx/opc/shared.py -> build/lib/docx/opc
    copying docx/opc/coreprops.py -> build/lib/docx/opc
    copying docx/opc/part.py -> build/lib/docx/opc
    copying docx/opc/constants.py -> build/lib/docx/opc
    copying docx/opc/spec.py -> build/lib/docx/opc
    copying docx/opc/pkgreader.py -> build/lib/docx/opc
    copying docx/opc/packuri.py -> build/lib/docx/opc
    copying docx/opc/__init__.py -> build/lib/docx/opc
    copying docx/opc/compat.py -> build/lib/docx/opc
    copying docx/opc/exceptions.py -> build/lib/docx/opc
    copying docx/opc/rel.py -> build/lib/docx/opc
    copying docx/opc/package.py -> build/lib/docx/opc
    copying docx/opc/phys_pkg.py -> build/lib/docx/opc
    copying docx/opc/pkgwriter.py -> build/lib/docx/opc
    creating build/lib/docx/text
    copying docx/text/parfmt.py -> build/lib/docx/text
    copying docx/text/font.py -> build/lib/docx/text
    copying docx/text/paragraph.py -> build/lib/docx/text
    copying docx/text/__init__.py -> build/lib/docx/text
    copying docx/text/tabstops.py -> build/lib/docx/text
    copying docx/text/run.py -> build/lib/docx/text
    creating build/lib/docx/enum
    copying docx/enum/section.py -> build/lib/docx/enum
    copying docx/enum/text.py -> build/lib/docx/enum
    copying docx/enum/base.py -> build/lib/docx/enum
    copying docx/enum/shape.py -> build/lib/docx/enum
    copying docx/enum/table.py -> build/lib/docx/enum
    copying docx/enum/__init__.py -> build/lib/docx/enum
    copying docx/enum/dml.py -> build/lib/docx/enum
    copying docx/enum/style.py -> build/lib/docx/enum
    creating build/lib/docx/dml
    copying docx/dml/color.py -> build/lib/docx/dml
    copying docx/dml/__init__.py -> build/lib/docx/dml
    creating build/lib/docx/parts
    copying docx/parts/story.py -> build/lib/docx/parts
    copying docx/parts/numbering.py -> build/lib/docx/parts
    copying docx/parts/styles.py -> build/lib/docx/parts
    copying docx/parts/settings.py -> build/lib/docx/parts
    copying docx/parts/document.py -> build/lib/docx/parts
    copying docx/parts/image.py -> build/lib/docx/parts
    copying docx/parts/__init__.py -> build/lib/docx/parts
    copying docx/parts/hdrftr.py -> build/lib/docx/parts
    creating build/lib/docx/oxml
    copying docx/oxml/shared.py -> build/lib/docx/oxml
    copying docx/oxml/numbering.py -> build/lib/docx/oxml
    copying docx/oxml/styles.py -> build/lib/docx/oxml
    copying docx/oxml/coreprops.py -> build/lib/docx/oxml
    copying docx/oxml/section.py -> build/lib/docx/oxml
    copying docx/oxml/shape.py -> build/lib/docx/oxml
    copying docx/oxml/settings.py -> build/lib/docx/oxml
    copying docx/oxml/document.py -> build/lib/docx/oxml
    copying docx/oxml/table.py -> build/lib/docx/oxml
    copying docx/oxml/__init__.py -> build/lib/docx/oxml
    copying docx/oxml/exceptions.py -> build/lib/docx/oxml
    copying docx/oxml/simpletypes.py -> build/lib/docx/oxml
    copying docx/oxml/xmlchemy.py -> build/lib/docx/oxml
    copying docx/oxml/ns.py -> build/lib/docx/oxml
    creating build/lib/docx/opc/parts
    copying docx/opc/parts/coreprops.py -> build/lib/docx/opc/parts
    copying docx/opc/parts/__init__.py -> build/lib/docx/opc/parts
    creating build/lib/docx/oxml/text
    copying docx/oxml/text/parfmt.py -> build/lib/docx/oxml/text
    copying docx/oxml/text/font.py -> build/lib/docx/oxml/text
    copying docx/oxml/text/paragraph.py -> build/lib/docx/oxml/text
    copying docx/oxml/text/__init__.py -> build/lib/docx/oxml/text
    copying docx/oxml/text/run.py -> build/lib/docx/oxml/text
    creating build/lib/docx/templates
    copying docx/templates/default-header.xml -> build/lib/docx/templates
    error: can't copy 'docx/templates/default-docx-template': doesn't exist or not a regular file
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vbrTnn/python-docx/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vbrTnn/python-docx/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_hd1wy/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python2.7/python-docx Check the logs for full command output.

I’m not used to using python all that much or PIP so i really have no idea what these errors mean, please could someone help out?

2

Answers


  1. You can try this before

    pip install wheel
    
    Login or Signup to reply.
  2. There is a known problem with a prior version of setuptools. If you upgrade that this should go away: How to use PIP to install python-docx?

    pip install -U setuptools
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search