frescobaldi / python-poppler-qt5

Python binding to libpoppler-qt5
Other
42 stars 32 forks source link

python 3.10: pip install fails #57

Closed kakila closed 1 year ago

kakila commented 1 year ago

I tried installing from pypi and failed, then I tried directly from the repository:

$ pip install git+https://github.com/frescobaldi/python-poppler-qt5.git
Collecting git+https://github.com/frescobaldi/python-poppler-qt5.git
  Cloning https://github.com/frescobaldi/python-poppler-qt5.git to ./pip-req-build-rdc44o7z
  Running command git clone --filter=blob:none --quiet https://github.com/frescobaldi/python-poppler-qt5.git /tmp/pip-req-build-rdc44o7z
  Resolved https://github.com/frescobaldi/python-poppler-qt5.git to commit b9b95ae34b7892ec702fa67d1ff2e8c68ccd076a
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [38 lines of output]
      Querying qmake about your Qt installation...
      Package poppler-qt5 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `poppler-qt5.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'poppler-qt5' found
      Traceback (most recent call last):
        File "/tmp/tt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/tmp/tt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/tmp/tt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/tmp/tt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/sipbuild/api.py", line 46, in build_wheel
          project = AbstractProject.bootstrap('wheel',
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/sipbuild/abstract_project.py", line 87, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 585, in setup
          self.apply_user_defaults(tool)
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 239, in apply_user_defaults
          bindings.apply_user_defaults(tool)
        File "/tmp/pip-req-build-rdc44o7z/project.py", line 50, in apply_user_defaults
          cflags = self.run_pkg_config('--cflags-only-I').split()
        File "/tmp/pip-req-build-rdc44o7z/project.py", line 43, in run_pkg_config
          output = subprocess.check_output(
        File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/usr/lib/python3.10/subprocess.py", line 524, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['pkg-config', '--cflags-only-I', 'poppler-qt5']' returned non-zero exit status 1.
      [end of output]

  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.
hint: See above for details.
$ pip --version
pip 22.2.2 from /tmp/tt/lib/python3.10/site-packages/pip (python 3.10)
fedelibre commented 1 year ago

Try following the suggestions in this discussion

fedelibre commented 1 year ago
Querying qmake about your Qt installation...
      Package poppler-qt5 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `poppler-qt5.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'poppler-qt5' found

It seems you did not install Poppler. Unfortunately the Chocolatey package manager currently provides a too old version:

$ choco search Poppler
Chocolatey v1.2.1
poppler 0.89.0 [Approved]

An alternative might be https://github.com/oschwartz10612/poppler-windows

@19joho66 How are you used to install Poppler on Windows?

jeanas commented 1 year ago

python-poppler-qt5 does not currently have prebuilt versions on PyPI, so pip tries to install it from source, which fails in your case because you're missing the qmake build tool (and perhaps other dependencies like Poppler itself). These can be installed on Anaconda or Miniconda using Conda.

I will close this issue; see https://github.com/frescobaldi/python-poppler-qt5/issues/42 to track the progress of making prebuilt versions.