Skip to content

PlotTracks: PyPDF2 has depreciated the PdfFileMerger method #340

@harnold-hci

Description

@harnold-hci

Quick bug report - I believe that tobias currently installs the newest version of PyPDF2 which has since depreciated the PdfFileMerger method.

When running PlotTracks, the following error message is generated:

2025-12-12 15:29:45 (920418) [INFO]     Plotting region: ['chr4', '119628321', '119629356']
Traceback (most recent call last):
  File "/tomato/ModuleSoftware/tobias/tobias-0.17.2/bin/TOBIAS", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/tomato/ModuleSoftware/tobias/tobias-0.17.2/lib/python3.12/site-packages/tobias/TOBIAS.py", line 163, in main
    args.func(args)
    ^^^^^^^^^^^^^^^
  File "/tomato/ModuleSoftware/tobias/tobias-0.17.2/lib/python3.12/site-packages/tobias/tools/plot_tracks.py", line 391, in run_tracks
    merger = PdfFileMerger(strict=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tomato/ModuleSoftware/tobias/tobias-0.17.2/lib/python3.12/site-packages/PyPDF2/_merger.py", line 817, in __init__
    deprecation_with_replacement("PdfFileMerger", "PdfMerger", "3.0.0")
  File "/tomato/ModuleSoftware/tobias/tobias-0.17.2/lib/python3.12/site-packages/PyPDF2/_utils.py", line 369, in deprecation_with_replacement
    deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
  File "/tomato/ModuleSoftware/tobias/tobias-0.17.2/lib/python3.12/site-packages/PyPDF2/_utils.py", line 351, in deprecation
    raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: PdfFileMerger is deprecated and was removed in PyPDF2 3.0.0. Use PdfMerger instead.

This solution was posted a couple years back (see below) and still fixed the issue by installing PyPDF2-2.12-1 to replace PyPDF2-3.0.1.

So - easy fix, but figured I would make note of it!

Insalling PyPDF2<3.0 fixed the issue.

pip install 'PyPDF2<3.0'

Originally posted in #200

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions