oschwartz10612 / poppler-windows

Download Poppler binaries packaged for Windows with dependencies
MIT License
549 stars 59 forks source link

How to install poppler on Windows10 ? (step by step) #42

Closed me-suzy closed 1 year ago

me-suzy commented 2 years ago

hello. How to install poppler on Windows10 ? (step by step for beginners)

I need to install for some Python code.

Because the command pip install poppler doesn't work ! Also, I install the pdf2image library, but I get this error.

image

Donnbk commented 1 year ago

Hi me-suzy,

  1. The package named "poppler" doesn't exist. You can use the command to check the package in Python.
    pip index versions [name_package]
  2. For installing poppler on Windows 10:

    • You can use "scoop" tool to install many apps as Unix Os ( source: https://scoop.sh/)
      scoop install poppler
    • If you install python, you can use a package called python-poppler (source: https://pypi.org/project/python-poppler/) (Edited: But this way is hard to build and install on Windows).

    I hope it's helpful to you.

manasimahajann commented 1 year ago

I just ran above cmd 'pip install python-poppler' on windows machine, tried using admin mode also but still unable to install it.. I have installed cmake using 'pip install cmake', installed wheel as well.. Below is the error -- ERROR: Command errored out with exit status 1: command: 'C:\Program Files\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\User\AppData\Local\Temp\pip-install-ukoz8kqh\python-poppler_be5aae3fb1674a9d9639e78a0351048b\setup.py'"'"'; file='"'"'C:\Users\User\AppData\Local\Temp\pip-install-ukoz8kqh\python-poppler_be5aae3fb1674a9d9639e78a0351048b\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 'C:\Users\User\AppData\Local\Temp\pip-record-gnjhwuts\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files\Python310\Include\python-poppler' cwd: C:\Users\User\AppData\Local\Temp\pip-install-ukoz8kqh\python-poppler_be5aae3fb1674a9d9639e78a0351048b\ Complete output (74 lines): running install running build running build_py creating build creating build\lib.win-amd64-3.10 creating build\lib.win-amd64-3.10\poppler copying src\poppler\destination.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\document.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\embeddedfile.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\font.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\image.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\page.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\pagerenderer.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\pagetransition.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\rectangle.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\toc.py -> build\lib.win-amd64-3.10\poppler copying src\poppler\utilities.py -> build\lib.win-amd64-3.10\poppler copying src\poppler_version.py -> build\lib.win-amd64-3.10\poppler copying src\poppler__init.py -> build\lib.win-amd64-3.10\poppler creating build\lib.win-amd64-3.10\poppler\cpp copying src\poppler\cpp__init__.py -> build\lib.win-amd64-3.10\poppler\cpp running egg_info writing src\python_poppler.egg-info\PKG-INFO writing dependency_links to src\python_poppler.egg-info\dependency_links.txt writing top-level names to src\python_poppler.egg-info\top_level.txt reading manifest file 'src\python_poppler.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE.txt' writing manifest file 'src\python_poppler.egg-info\SOURCES.txt' running build_ext Traceback (most recent call last): File "C:\Users\User\AppData\Local\Temp\pip-install-ukoz8kqh\python-poppler_be5aae3fb1674a9d9639e78a0351048b\setup.py", line 24, in run out = subprocess.check_output(["cmake", "--version"]) File "C:\Program Files\Python310\lib\subprocess.py", line 420, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Program Files\Python310\lib\subprocess.py", line 501, in run with Popen(popenargs, **kwargs) as process: File "C:\Program Files\Python310\lib\subprocess.py", line 966, in init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\Python310\lib\subprocess.py", line 1435, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Temp\pip-install-ukoz8kqh\python-poppler_be5aae3fb1674a9d9639e78a0351048b\setup.py", line 76, in <module>
    setup(
  File "C:\Program Files\Python310\lib\site-packages\setuptools\__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "C:\Program Files\Python310\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Program Files\Python310\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Program Files\Python310\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Program Files\Python310\lib\site-packages\setuptools\command\install.py", line 61, in run
    return orig.install.run(self)
  File "C:\Program Files\Python310\lib\distutils\command\install.py", line 568, in run
    self.run_command('build')
  File "C:\Program Files\Python310\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Program Files\Python310\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Program Files\Python310\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Program Files\Python310\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Program Files\Python310\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\User\AppData\Local\Temp\pip-install-ukoz8kqh\python-poppler_be5aae3fb1674a9d9639e78a0351048b\setup.py", line 26, in run
    raise RuntimeError(
RuntimeError: CMake must be installed to build the following extensions: poppler.cpp.modules
----------------------------------------

ERROR: Command errored out with exit status 1: 'C:\Program Files\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\User\AppData\Local\Temp\pip-install-ukoz8kqh\python-poppler_be5aae3fb1674a9d9639e78a0351048b\setup.py'"'"'; file='"'"'C:\Users\User\AppData\Local\Temp\pip-install-ukoz8kqh\python-poppler_be5aae3fb1674a9d9639e78a0351048b\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 'C:\Users\User\AppData\Local\Temp\pip-record-gnjhwuts\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Program Files\Python310\Include\python-poppler' Check the logs for full command output.

Donnbk commented 1 year ago

Hi @manasimahajann,

About the error in installing python-poppler. This way is complex to build and install on Windows. I think you should open an issue at the repository: https://github.com/cbrunet/python-poppler. Some people in that repository will support you better.

You can also read some information at the following links:

Good luck.

oschwartz10612 commented 1 year ago

Thanks @Donnbk for trying to help. I think your point is good: this repository is not here to support installing via pip, please use the resources above for help with that.

If you would like to use the binaries in the repository, download the zip from releases then exact it. If you are using pdf2image then you will then have to add the bin/ folder to PATH or use poppler_path = r"C:\path\to\poppler-xx\bin" as an argument in convert_from_path.

manasimahajann commented 1 year ago

Thank you very much.. downloading the zip and adding it to the path worked :)