maxpmaxp / pdfreader

Python API for PDF documents
MIT License
113 stars 26 forks source link

Unable to install #84

Closed afkcodes closed 3 years ago

afkcodes commented 3 years ago
 python -m pip install pdfreader
Defaulting to user installation because normal site-packages is not writeable
Collecting pdfreader
  Using cached pdfreader-0.1.10-py3-none-any.whl
Collecting python-dateutil>=2.8.1
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting pycryptodome>=3.9.9
  Using cached pycryptodome-3.10.1-cp35-abi3-manylinux2010_x86_64.whl (1.9 MB)
Collecting bitarray>=1.1.0
  Using cached bitarray-2.0.1.tar.gz (69 kB)
Collecting pillow>=7.1.0
  Using cached Pillow-8.2.0-cp38-cp38-manylinux1_x86_64.whl (3.0 MB)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.8.1->pdfreader) (1.15.0)
Building wheels for collected packages: bitarray
  Building wheel for bitarray (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-orcjenb1/bitarray_deb7d2b3884541ef8ed65f545a1864d8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-orcjenb1/bitarray_deb7d2b3884541ef8ed65f545a1864d8/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-uy_9ksyu
       cwd: /tmp/pip-install-orcjenb1/bitarray_deb7d2b3884541ef8ed65f545a1864d8/
  Complete output (23 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/bitarray
  copying bitarray/util.py -> build/lib.linux-x86_64-3.8/bitarray
  copying bitarray/test_bitarray.py -> build/lib.linux-x86_64-3.8/bitarray
  copying bitarray/test_util.py -> build/lib.linux-x86_64-3.8/bitarray
  copying bitarray/__init__.py -> build/lib.linux-x86_64-3.8/bitarray
  copying bitarray/bitarray.h -> build/lib.linux-x86_64-3.8/bitarray
  copying bitarray/pythoncapi_compat.h -> build/lib.linux-x86_64-3.8/bitarray
  copying bitarray/test_data.pickle -> build/lib.linux-x86_64-3.8/bitarray
  running build_ext
  building 'bitarray._bitarray' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/bitarray
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c bitarray/_bitarray.c -o build/temp.linux-x86_64-3.8/bitarray/_bitarray.o
  bitarray/_bitarray.c:12:10: fatal error: Python.h: No such file or directory
     12 | #include "Python.h"
        |          ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for bitarray
  Running setup.py clean for bitarray
Failed to build bitarray
Installing collected packages: python-dateutil, pycryptodome, pillow, bitarray, pdfreader
    Running setup.py install for bitarray ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-orcjenb1/bitarray_deb7d2b3884541ef8ed65f545a1864d8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-orcjenb1/bitarray_deb7d2b3884541ef8ed65f545a1864d8/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-cdf7jeet/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ashish/.local/include/python3.8/bitarray
         cwd: /tmp/pip-install-orcjenb1/bitarray_deb7d2b3884541ef8ed65f545a1864d8/
    Complete output (23 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/bitarray
    copying bitarray/util.py -> build/lib.linux-x86_64-3.8/bitarray
    copying bitarray/test_bitarray.py -> build/lib.linux-x86_64-3.8/bitarray
    copying bitarray/test_util.py -> build/lib.linux-x86_64-3.8/bitarray
    copying bitarray/__init__.py -> build/lib.linux-x86_64-3.8/bitarray
    copying bitarray/bitarray.h -> build/lib.linux-x86_64-3.8/bitarray
    copying bitarray/pythoncapi_compat.h -> build/lib.linux-x86_64-3.8/bitarray
    copying bitarray/test_data.pickle -> build/lib.linux-x86_64-3.8/bitarray
    running build_ext
    building 'bitarray._bitarray' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/bitarray
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c bitarray/_bitarray.c -o build/temp.linux-x86_64-3.8/bitarray/_bitarray.o
    bitarray/_bitarray.c:12:10: fatal error: Python.h: No such file or directory
       12 | #include "Python.h"
          |          ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-orcjenb1/bitarray_deb7d2b3884541ef8ed65f545a1864d8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-orcjenb1/bitarray_deb7d2b3884541ef8ed65f545a1864d8/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-cdf7jeet/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ashish/.local/include/python3.8/bitarray Check the logs for full command output.

Facing the following error please help

iorlas commented 3 years ago

It says it has missing Python.h file, which is a part of Python SDK. Basically, you have to install python-dev package in your system, like this: sudo apt install python3-dev

afkcodes commented 3 years ago

this worked thanks @iorlas