Skip to content

pix2tex[gui] with pyqt6 fails in starting #419

@blkatbyhh

Description

@blkatbyhh

Windows 10 with nvidia gpu, conda environment with python 3.10, installed torch from pytorch.org.

Install the pix2tex[gui] from 0.1.4 to 0.0.31, when the application starts, its window appears for a while and then crash. Meanwhile, command line show following error:

[1832:2812:0417/004623.773:ERROR:shared_image_factory.cc(880)] Could not find SharedImageBackingFactory with params: usage: Gles2Read|DisplayRead|DisplayWrite|Scanout, format: RGBA_8888, share_between_threads: 0, gmb_type: empty, debug_label: QWE_SharedImageBuffer
[1832:2812:0417/004623.773:ERROR:native_skia_output_device.cpp(253)] CreateSharedImage failed.
[1832:2812:0417/004623.773:ERROR:raster_decoder.cc(1146)]   RasterDecoderImpl: Context lost during MakeCurrent.
[1832:2812:0417/004623.774:ERROR:raster_decoder.cc(1146)]   RasterDecoderImpl: Context lost during MakeCurrent.
[1832:2812:0417/004623.774:ERROR:raster_decoder.cc(1146)]   RasterDecoderImpl: Context lost during MakeCurrent.
[1832:2812:0417/004623.774:ERROR:raster_decoder.cc(1146)]   RasterDecoderImpl: Context lost during MakeCurrent.
[1832:2812:0417/004623.780:ERROR:shared_context_state.cc(885)] Failed to make current since context is marked as lost
[1832:2812:0417/004623.780:ERROR:skia_output_surface_impl_on_gpu.cc(2264)] Failed to make current.

If I destroy the conda environment, and fresh install a python==3.10, pix2tex[gui]==0.0.29, the application crash directly without window pops up, the error message are:

C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\albumentations\core\validation.py:87: UserWarning: ShiftScaleRotate is a special case of Affine transform. Please use Affine transform instead.
  original_init(self, **validated_kwargs)
C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\pix2tex\dataset\transforms.py:7: UserWarning: Argument(s) 'value' are not valid for transform ShiftScaleRotate
  [alb.ShiftScaleRotate(shift_limit=0, scale_limit=(-.15, 0), rotate_limit=1, border_mode=0, interpolation=3,
C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\pix2tex\dataset\transforms.py:9: UserWarning: Argument(s) 'border_mode, value' are not valid for transform GridDistortion
  alb.GridDistortion(distort_limit=0.1, border_mode=0, interpolation=3, value=[255, 255, 255], p=.5)], p=.15),
Traceback (most recent call last):
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\albumentations\core\validation.py", line 43, in _validate_parameters
    config = schema_cls(**{k: v for k, v in full_kwargs.items() if k in param_names})
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\pydantic\main.py", line 253, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for InitSchema
std_range
  Input should be a valid tuple [type=tuple_type, input_value=10, input_type=int]
    For further information visit https://errors.pydantic.dev/2.11/v/tuple_type

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

Traceback (most recent call last):
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\Scripts\latexocr.exe\__main__.py", line 7, in <module>
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\pix2tex\__main__.py", line 25, in main
    from .gui import main
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\pix2tex\gui.py", line 17, in <module>
    from pix2tex import cli
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\pix2tex\cli.py", line 1, in <module>
    from pix2tex.dataset.transforms import test_transform
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\pix2tex\dataset\transforms.py", line 13, in <module>
    alb.GaussNoise(10, p=.2),
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\albumentations\core\validation.py", line 78, in custom_init
    validated_kwargs = cls._validate_parameters(
  File "C:\Users\USERNAME\scoop\apps\miniconda3\current\envs\latexocr\lib\site-packages\albumentations\core\validation.py", line 47, in _validate_parameters
    raise ValueError(str(e)) from e
ValueError: 1 validation error for InitSchema
std_range
  Input should be a valid tuple [type=tuple_type, input_value=10, input_type=int]
    For further information visit https://errors.pydantic.dev/2.11/v/tuple_type

However, I have found a stupid solution:

In the conda virtual environment, install the pix2tex[gui] 0.1.4 and then downgrade vesion by version all the way to 0.0.29, the application works well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions