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

Problem with bz2 module #445

Open
AlexanderAverin opened this issue Dec 29, 2024 · 0 comments
Open

Problem with bz2 module #445

AlexanderAverin opened this issue Dec 29, 2024 · 0 comments

Comments

@AlexanderAverin
Copy link

This topic is probably very silly, but I have a problem I'd like to solve. I don't use Python for work, so I can't remember all the nuances of setting up the environment...

I have installed all the packages as indicated in the readme, but when I try to process a pdf I get this error:

Traceback (most recent call last):
  File “/home/alexander/.local/lib/python3.12/site-packages/transformers/utils/import_utils.py”, line 1793, in _get_module
    return importlib.import_module(“.” + module_name, self.__name__)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File “/usr/local/lib/python3.12/importlib/__init__.py”, line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File “<frozen importlib._bootstrap>”, line 1387, in _gcd_import
  File “<frozen importlib._bootstrap>”, line 1360, in _find_and_load
  File “<frozen importlib._bootstrap>”, line 1331, in _find_and_load_unlocked
  File “<frozen importlib._bootstrap>”, line 935, in _load_unlocked
  File “<frozen importlib._bootstrap_external>”, line 995, in exec_module
  File “<frozen importlib._bootstrap>”, line 488, in _call_with_frames_removed
  File “/home/alexander/.local/lib/python3.12/site-packages/transformers/modeling_utils.py”, line 48, in <module>
    from .loss.loss_utils import LOSS_MAPPING
  File “/home/alexander/.local/lib/python3.12/site-packages/transformers/loss/loss_utils.py”, line 19, in <module>
    from .loss_deformable_detr import DeformableDetrForObjectDetectionLoss, DeformableDetrForSegmentationLoss
  File “/home/alexander/.local/lib/python3.12/site-packages/transformers/loss/loss_deformable_detr.py”, line 4, in <module>
    from ..image_transforms import center_to_corners_format
  File “/home/alexander/.local/lib/python3.12/site-packages/transformers/image_transforms.py”, line 22, in <module>
    from .image_utils import (
  File “/home/alexander/.local/lib/python3.12/site-packages/transformers/image_utils.py”, line 59, in <module>
    from torchvision.transforms import InterpolationMode
  File “/home/alexander/.local/lib/python3.12/site-packages/torchvision/__init__.py”, line 10, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File “/home/alexander/.local/lib/python3.12/site-packages/torchvision/datasets/__init__.py”, line 1, in <module>
    from ._optical_flow import FlyingChairs, FlyingThings3D, HD1K, KittiFlow, Sintel
  File “/home/alexander/.local/lib/python3.12/site-packages/torchvision/datasets/_optical_flow.py”, line 13, in <module>
    from .utils import _read_pfm, verify_str_arg
  File “/home/alexander/.local/lib/python3.12/site-packages/torchvision/datasets/utils.py”, line 1, in <module>
    import bz2
  File “/usr/local/lib/python3.12/bz2.py”, line 17, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File “/home/alexander/.local/bin/marker_single”, line 5, in <module>
    from convert_single import main
  File “/home/alexander/.local/lib/python3.12/site-packages/convert_single.py”, line 11, in <module>
    from marker.converters.pdf import PdfConverter
  File “/home/alexander/.local/lib/python3.12/site-packages/marker/converters/pdf.py”, line 8, in <module>
    from marker.builders.document import DocumentBuilder
  File “/home/alexander/.local/lib/python3.12/site-packages/marker/builders/document.py”, line 3, in <module>
    from marker.builders.layout import LayoutBuilder
  File “/home/alexander/.local/lib/python3.12/site-packages/marker/builders/layout.py”, line 6, in <module>
    from surya.model.layout.encoderdecoder import SuryaLayoutModel
  File “/home/alexander/.local/lib/python3.12/site-packages/surya/model/layout/encoderdecoder.py”, line 5, in <module>
    from transformers import PreTrainedModel, VisionEncoderDecoderConfig, PretrainedConfig
  File “<frozen importlib._bootstrap>”, line 1412, in _handle_fromlist
  File “/home/alexander/.local/lib/python3.12/site-packages/transformers/utils/import_utils.py”, line 1781, in __getattr__
    module = self._get_module(self._class_to_module[name])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File “/home/alexander/.local/lib/python3.12/site-packages/transformers/utils/import_utils.py”, line 1795, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.modeling_utils because of the following error (look up to see its traceback):
No module named '_bz2'

Of course I tried rebuilding Python and reinstalling all the packages, but that didn't help....

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

No branches or pull requests

1 participant