Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.23.9rc1: module 'fitz.mupdf' has no attribute 'fz_copy_pixmap_rect' #2978

Closed
cbm755 opened this issue Jan 4, 2024 · 7 comments
Closed
Labels

Comments

@cbm755
Copy link
Contributor

cbm755 commented Jan 4, 2024

Description of the bug

I tried the rebased fitz for the first time (sorry have been lax about following that). My test suite dies with this:

  File "/builds/plom/plom/plom_server/Finish/services/soln_source.py", line 129, in take_solution_source_pdf_from_upload
    self._create_solution_images(version, doc)
  File "/builds/plom/plom/plom_server/Finish/services/soln_source.py", line 148, in _create_solution_images
    soln_img.copy(pix, pix.irect)
  File "/usr/local/lib/python3.10/dist-packages/fitz/__init__.py", line 9753, in copy
    mupdf.fz_copy_pixmap_rect(pm, src_pix, JM_irect_from_py(bbox), mupdf.FzDefaultColorspaces(None))
AttributeError: module 'fitz.mupdf' has no attribute 'fz_copy_pixmap_rect'

How to reproduce the bug

For now, its just this CI output:

https://gitlab.com/plom/plom/-/jobs/5863036742

If I get a chance later, I will try to narrow it down... but I thought it might be useful report first and track later.

PyMuPDF version

1.23.9rc1

Operating system

Linux

Python version

3.10

@cbm755
Copy link
Contributor Author

cbm755 commented Jan 4, 2024

Pretty far from a MWE, but the code that is triggering this is:

            # see https://pymupdf.readthedocs.io/en/latest/recipes-images.html#how-to-use-pixmaps-gluing-images
            # get an image for each page - note fitz pages are 0-indexed.
            pix_list = [doc[pg - 1].get_pixmap() for pg in sqs_obj.pages]
            total_w = sum([X.width for X in pix_list])
            max_h = max([X.height for X in pix_list])
            # creage a dest image on which to tile these images - with given max height and total width.
            soln_img = fitz.Pixmap(
                pix_list[0].colorspace, (0, 0, total_w, max_h), pix_list[0].alpha
            )
            # concat the images together into the dest image.
            starting_x = 0
            for pix in pix_list:
                pix.set_origin(starting_x, 0)
                soln_img.copy(pix, pix.irect)     # <---  exception here
                starting_x += pix.width

@cbm755
Copy link
Contributor Author

cbm755 commented Jan 4, 2024

I checked and it does seem to be using the RC of PyMuPDFb as well:

#11 16.56 Collecting PyMuPDFb==1.23.9rc1 (from pymupdf==1.23.9rc1->-r requirements.txt (line 58))
#11 16.58   Downloading PyMuPDFb-1.23.9rc1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (1.4 kB)

11 8.445 Collecting pymupdf==1.23.9rc1 (from -r requirements.txt (line 58))
#11 8.463   Downloading PyMuPDF-1.23.9rc1-cp310-none-manylinux2014_x86_64.whl.metadata (3.4 kB)

@julian-smith-artifex-com
Copy link
Collaborator

Thanks for this.

Yes, you're quite right, it's missing from MuPDF's public API and thus breaking the rebased implementation.

Am working on a fix now.

@julian-smith-artifex-com
Copy link
Collaborator

This is fixed in release candidate 1.23.9rc2; see: #2996

@cbm755
Copy link
Contributor Author

cbm755 commented Jan 9, 2024

Confirmed fixed at my end. Closing.

@cbm755 cbm755 closed this as completed Jan 9, 2024
@julian-smith-artifex-com
Copy link
Collaborator

Reopening until the fix is in a full release.

@julian-smith-artifex-com
Copy link
Collaborator

Fixed in 1.23.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants