python-poppler icon indicating copy to clipboard operation
python-poppler copied to clipboard

Poetry and pip don't install python-poppler

Open aigulkhkmv opened this issue 10 months ago • 7 comments

Dear python-poppler developers,

I found information in this issue that the installation problems were solved in 0.4.0+ versions. However I can't install lib using poetry (poetry add python-poppler) or pip (poetry install python-poppler) for none of versions (not 0.4.0 or 0.4.1).

System info:

  • Python 3.10
  • System: Debian GNU/Linux 12 (bookworm)

Error:

../meson.build:11:14: ERROR: Dependency "poppler-cpp" not found, tried pkgconfig and cmake
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

Could you help please, how I can install python-poppler using poetry or pip? Many thanks!

aigulkhkmv avatar Jan 16 '25 15:01 aigulkhkmv

I got the following error while trying to pip install this library (v0.4.1):

      In file included from ../src/cpp/image.cpp:20:
      ../subprojects/pybind11-2.10.3/include/pybind11/pybind11.h:218:13: error: static assertion failed due to requirement 'expected_num_args<pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::arg_v>(sizeof...(Args), argument_loader<const poppler::image *>::args_pos >= 0, argument_loader<const poppler::image *>::has_kwargs)': The number of argument annotations does not match the number of function arguments
        218 |             expected_num_args<Extra...>(
            |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        219 |                 sizeof...(Args), cast_in::args_pos >= 0, cast_in::has_kwargs),
            |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

blixt avatar Jan 27 '25 12:01 blixt

Same here on an M3 Macbook Air with poppler version 25.02.0 from Homebrew:

      Build type: native build
      Project name: python-poppler
      Project version: 0.4.1
      C++ compiler for the host machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
      C++ linker for the host machine: c++ ld64 1115.7.3
      Host machine cpu family: aarch64
      Host machine cpu: aarch64
      Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.3.0
      Run-time dependency poppler-cpp found: YES 25.02.0
      Program python3 found: YES (/Users/russ/Projects/Code_With_Aloha/CURRENT/uipa/.venv/bin/python3)
      Downloading pybind11 source from https://github.com/pybind/pybind11/archive/refs/tags/v2.10.3.tar.gz
      Downloading file of unknown size.
      Downloading pybind11 patch from https://wrapdb.mesonbuild.com/v2/pybind11_2.10.3-1/get_patch

      Executing subproject pybind11

      pybind11| Project name: pybind11
      pybind11| Project version: 2.10.3
      pybind11| C++ compiler for the host machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
      pybind11| C++ linker for the host machine: c++ ld64 1115.7.3
      pybind11| Build targets in project: 0
      pybind11| Subproject pybind11 finished.

      Configuring _version.py using configuration
      Run-time dependency python found: YES 3.13
      Build targets in project: 13

      python-poppler 0.4.1

        Subprojects
          pybind11    : YES

        User defined options
          Native files: /private/var/folders/51/kl0192zn13qflpmdd8t8y4240000gn/T/pip-install-qyxqkf01/python-poppler_b19f4b884ad4471d990aea747d67541d/.mesonpy-adeqs_2k/meson-python-native-file.ini
          b_ndebug    : if-release
          b_vscrt     : md
          buildtype   : release

      Found ninja-1.11.1.git.kitware.jobserver-1 at /private/var/folders/51/kl0192zn13qflpmdd8t8y4240000gn/T/pip-build-env-tin04sog/normal/bin/ninja
      + /private/var/folders/51/kl0192zn13qflpmdd8t8y4240000gn/T/pip-build-env-tin04sog/normal/bin/ninja
      [1/26] Compiling C++ object src/cpp/image.cpython-313-darwin.so.p/image.cpp.o
      FAILED: src/cpp/image.cpython-313-darwin.so.p/image.cpp.o
      c++ -Isrc/cpp/image.cpython-313-darwin.so.p -Isrc/cpp -I../src/cpp -I../subprojects/pybind11-2.10.3/include -I/opt/homebrew/Cellar/poppler/25.02.0/include/poppler/cpp -I/opt/homebrew/Cellar/poppler/25.02.0/include/poppler -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.13/include/python3.13 -fvisibility=hidden -fvisibility-inlines-hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c++11 -O3 -MD -MQ src/cpp/image.cpython-313-darwin.so.p/image.cpp.o -MF src/cpp/image.cpython-313-darwin.so.p/image.cpp.o.d -o src/cpp/image.cpython-313-darwin.so.p/image.cpp.o -c ../src/cpp/image.cpp
      ../src/cpp/image.cpp:32:11: warning: variable 'img_data' set but not used [-Wunused-but-set-variable]
         32 |     char *img_data = img.data();
            |           ^
      In file included from ../src/cpp/image.cpp:20:
      ../subprojects/pybind11-2.10.3/include/pybind11/pybind11.h:218:13: error: static assertion failed due to requirement 'expected_num_args<pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::arg_v>(sizeof...(Args), argument_loader<const poppler::image *>::args_pos >= 0,argument_loader<const poppler::image *>::has_kwargs)': The number of argument annotations does not match the number of function arguments
        218 |             expected_num_args<Extra...>(
            |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        219 |                 sizeof...(Args), cast_in::args_pos >= 0, cast_in::has_kwargs),

russtoku avatar Feb 13 '25 00:02 russtoku

This is because the rect argument was dropped from image::copy, but the bindings still attempt to bind it: https://gitlab.freedesktop.org/poppler/poppler/-/commit/82cc4a30050ad39debce85a2b5f6e449cd7046f5

PRs #92 and #96 fix it.

philpax avatar Mar 05 '25 18:03 philpax

happens to me as well on python 12 64-bit

The Meson build system
Version: 1.7.0
Source dir: C:\Users\nirjo\AppData\Local\Temp\pip-install-xn3e1a2u\python-poppler_9dd6a991706c4940b305b1cd1fcab474
Build dir: C:\Users\nirjo\AppData\Local\Temp\pip-install-xn3e1a2u\python-poppler_9dd6a991706c4940b305b1cd1fcab474\.mesonpy-0uq9c7l2
Build type: native build
Project name: python-poppler
Project version: 0.4.1
WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe

JonNir1 avatar Mar 13 '25 09:03 JonNir1

That's a different issue - it appears that you don't have the Visual C++ build tools / Visual Studio installed, so it can't compile poppler.

philpax avatar Mar 13 '25 11:03 philpax

PR #96 resolved the issue for me. I really appreciate the suggestion in PR #92 by @philpax.

# Temporary fix for python-poppler issue #93 (https://github.com/cbrunet/python-poppler/issues/93)
python-poppler @ git+https://github.com/opale-ai/python-poppler.git@ca6678d

I just modified my requirements.txt to use this instead.

teleprint-me avatar Mar 20 '25 07:03 teleprint-me

The temp fix worked for me, too.

russtoku avatar Mar 20 '25 08:03 russtoku