dify icon indicating copy to clipboard operation
dify copied to clipboard

chore:bump pypdfium2 from 4.16.0 to 4.17.0

Open leslie2046 opened this issue 1 year ago • 7 comments

Description

fix:pip3 install pypdfium2==4.16.0

  • fail when pip3 install pypdfium2==4.16.0 图片
  • success when pip3 install pypdfium2==4.17.0 图片

Fixes # (issue)

Type of Change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update, included: Dify Document
  • [ ] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • [ ] Dependency upgrade

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [ ] TODO

Suggested Checklist:

  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] My changes generate no new warnings
  • [ ] I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • [ ] optional I have made corresponding changes to the documentation
  • [ ] optional I have added tests that prove my fix is effective or that my feature works
  • [ ] optional New and existing unit tests pass locally with my changes

leslie2046 avatar Apr 10 '24 09:04 leslie2046

Btw , in which Python version, have you encountered with the package installation failure?

bowenliang123 avatar Apr 10 '24 13:04 bowenliang123

Btw , in which Python version, have you encountered with the package installation failure?

4.16.0,can you successfully install ?

leslie2046 avatar Apr 10 '24 13:04 leslie2046

Excuse me, there's no Python 4.16.0. Is that 3.12 or sth like that?

bowenliang123 avatar Apr 10 '24 13:04 bowenliang123

Excuse me, there's no Python 4.16.0. Is that 3.12 or sth like that?

Python 3.10.13

leslie2046 avatar Apr 10 '24 13:04 leslie2046

I'm pretty sure we can successfully install all the pip packages from the ground up on Python 3.10 and 3.11, but not 3.12 (for the reason of gmpy2 package).

bowenliang123 avatar Apr 10 '24 13:04 bowenliang123

Excuse me, there's no Python 4.16.0. Is that 3.12 or sth like that?

Python 3.10.13

Thanks. Could you reset and uninstall all the packages , and try again. I'm using the same Python version.

bowenliang123 avatar Apr 10 '24 13:04 bowenliang123

Excuse me, there's no Python 4.16.0. Is that 3.12 or sth like that?

Python 3.10.13

Thanks. Could you reset and uninstall all the packages , and try again. I'm using the same Python version. I have create a new conda env with Python 3.10.13,and install all package from requirements.txt,same error as below

Collecting pypdfium2==4.16.0 (from -r requirements.txt (line 37)) Downloading pypdfium2-4.16.0.tar.gz (145 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 145.2/145.2 kB 75.4 kB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [52 lines of output] ['git', 'ls-remote', 'https://github.com/bblanchon/pdfium-binaries.git'] (cwd=None) Switching pdfium binary from None (v8 False) to 6406 (v8 False) ['ctypesgen', '--library', 'pdfium', '--runtime-libdir', '.', '--strip-build-path=/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_annot.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_attachment.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_catalog.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_dataavail.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_doc.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_edit.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_ext.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_flatten.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_formfill.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_fwlevent.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_javascript.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_ppo.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_progressive.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_save.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_searchex.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_signature.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_structtree.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_sysfontinfo.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_text.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_thumbnail.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_transformpage.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdfview.h', '-o', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/raw.py', '--no-srcinfo'] (cwd=PosixPath('/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64')) usage: ctypesgen [-h] [--version] [-i HEADERS [HEADERS ...]] [-l LIBRARY] -o FILE [--system-headers HEADER [HEADER ...]] [-m MODULE [MODULE ...]] [--linkage-anchor LINKAGE_ANCHOR] [-I INCLUDEDIR [INCLUDEDIR ...]] [-L LIBDIR [LIBDIR ...]] [--compile-libdirs LIBDIR [LIBDIR ...]] [--runtime-libdirs LIBDIR [LIBDIR ...]] [--no-system-libsearch] [--no-embed-templates] [--cpp CPP] [-D NAME [NAME ...]] [-U NAME [NAME ...]] [-X [ENTRY ...]] [--preproc-savepath FILENAME] [--preproc-errcheck | --no-preproc-errcheck] [--optimize-lexer] [-a] [--builtin-symbols] [--no-macros] [--no-undefs] [--symbol-rules SYMBOL_RULES [SYMBOL_RULES ...]] [--no-stddef-types] [--no-gnu-types] [--no-python-types] [--no-load-library] [--insert-files FILENAME [FILENAME ...]] [--output-language LANGUAGE] [--dllclass {CDLL,WinDLL,OleDLL,pythonapi}] [--no-symbol-guards] [--no-macro-guards] [--all-errors] [--show-long-errors] [--no-macro-warnings] [--debug-level DEBUG_LEVEL] ctypesgen: error: unrecognized arguments: --strip-build-path=/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_annot.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_attachment.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_catalog.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_dataavail.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_doc.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_edit.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_ext.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_flatten.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_formfill.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_fwlevent.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_javascript.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_ppo.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_progressive.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_save.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_searchex.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_signature.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_structtree.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_sysfontinfo.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_text.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_thumbnail.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_transformpage.h /tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdfview.h --no-srcinfo 'https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F6406/pdfium-linux-x64.tgz' -> '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/pdfium-linux-x64.tgz' Traceback (most recent call last): File "/home/njue/anaconda3/envs/dify/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/home/njue/anaconda3/envs/dify/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/njue/anaconda3/envs/dify/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-bko4mx9u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/pip-build-env-bko4mx9u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-bko4mx9u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 84, in File "", line 78, in main File "", line 59, in install_handler File "/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/setupsrc/pypdfium2_setup/update_pdfium.py", line 155, in main generate_bindings(archives, version) File "/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/setupsrc/pypdfium2_setup/update_pdfium.py", line 132, in generate_bindings call_ctypesgen(pl_dir, build_dir/"include") File "/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/setupsrc/pypdfium2_setup/packaging_base.py", line 235, in call_ctypesgen run_cmd(args, cwd=target_dir) File "/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/setupsrc/pypdfium2_setup/packaging_base.py", line 211, in run_cmd comp_process = subprocess.run(command, cwd=cwd, check=check, **kwargs) File "/home/njue/anaconda3/envs/dify/lib/python3.10/subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ctypesgen', '--library', 'pdfium', '--runtime-libdir', '.', '--strip-build-path=/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_annot.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_attachment.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_catalog.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_dataavail.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_doc.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_edit.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_ext.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_flatten.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_formfill.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_fwlevent.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_javascript.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_ppo.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_progressive.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_save.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_searchex.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_signature.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_structtree.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_sysfontinfo.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_text.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_thumbnail.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdf_transformpage.h', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/build_tar/include/fpdfview.h', '-o', '/tmp/pip-install-as4qbnk2/pypdfium2_e0a1cc3723d744ae83d9c603ebc4db18/data/linux_x64/raw.py', '--no-srcinfo']' returned non-zero exit status 2. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

leslie2046 avatar Apr 10 '24 14:04 leslie2046

The major difference in your environment comes with,

  1. no matched prebuilt 4.16.0 for your Linux, pip is trying to build the wheel locally instead.
  2. the failure caused by the unsupported parameter of ctypesgen
  3. pip download the prebuilt package of 4.17.0 as it is available

bowenliang123 avatar Apr 11 '24 00:04 bowenliang123

LGTM overall. Bumping pypdfium2 would help to solve the possible installation problem. cc @takatost

bowenliang123 avatar Apr 11 '24 00:04 bowenliang123

The major difference in your environment comes with,

1. no matched prebuilt 4.16.0 for your Linux, pip is trying to build the wheel locally instead.

2. the failure caused by the unsupported parameter of `ctypesgen`

3. pip download the prebuilt package of `4.17.0` as it is available

Thank you

leslie2046 avatar Apr 11 '24 01:04 leslie2046