Description of the bug
PyMuPDF Pro 1.27.1 hangs indefinitely when opening .docx files with pymupdf.Document() on Linux (x86_64). The hang occurs at the C level inside fz_open_document. The same files open successfully with PyMuPDF Pro 1.26.6 and also work fine on macOS with 1.27.1.
How to reproduce the bug
import multiprocessing
import time
def convert(path):
import pymupdf
import pymupdf.pro
pymupdf.pro.unlock("YOUR_PRO_KEY")
print(f"Version: {pymupdf.version}", flush=True)
start = time.perf_counter()
doc = pymupdf.Document(path) # <-- hangs here
print(f"Loaded in {time.perf_counter()-start:.1f}s, pages: {len(doc)}", flush=True)
if __name__ == "__main__":
p = multiprocessing.Process(target=convert, args=("test.docx",))
p.start()
p.join(30)
if p.is_alive():
print("HUNG after 30s")
p.kill()
Environment:
- Python 3.12 (
python:3.12-slim Docker image, Debian Trixie)
- PyMuPDF 1.27.1, PyMuPDFPro 1.27.1
- Linux x86_64 (native, not emulated)
libfontconfig1 and fonts-liberation installed
- Tested with multiple different
.docx files — all hang
Key observations:
- Without Pro unlocked,
pymupdf.Document() completes in ~0.1s on the same files
- With Pro unlocked on 1.26.6, completes in ~0.3s
- With Pro unlocked on 1.27.1, hangs indefinitely
- Works fine on macOS (both native ARM and x86_64)
- Works fine under QEMU/Rosetta x86_64 emulation on ARM — only hangs on native Linux x86_64
faulthandler.dump_traceback_later() shows the hang is in fz_open_document (mupdf.py line 50784)
PyMuPDF version
1.27.1
Operating system
Linux
Python version
3.12