Skip to content

Failed to initialize the main window. #192

@Minfinity010

Description

@Minfinity010

Describe the bug
When trying to start the program on a new Arch installation, it outputs an error, saying "AttributeError: module 'transformers.file_utils' has no attribute 'default_cache_path'"

To Reproduce
Steps to reproduce the behavior:

  1. Install for the first time/from scratch
  2. Start the program to begin the setup
  3. See error

Expected behavior
The program was expected to start its setup

Session Log

2026-03-15 14:29:28.876 | INFO     | pcleaner.cli_utils:dump_system_info:292 - 
- Program Information -
Program: Panel Cleaner 2.11.9
Executing from: /opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner/gui/launcher.py
Log file: /home/<username>/.cache/pcleaner/pcleaner.log
Config file: /home/<username>/.config/pcleaner/pcleanerrc
Cache directory: /home/<username>/.cache/pcleaner
- System Information -
Operating System: Linux 6.19.7-1-cachyos
Desktop Environment: KDE
Python Version: 3.14.3 (main, Feb 18 2026, 14:39:20) [GCC 15.2.1 20260209]
PySide (Qt) Version: 6.10.2
Available Qt Themes: Breeze, Windows, Fusion
Current Qt Theme: System Default
Current Icon Theme: System Default
System locale: es_MX
Architecture: x86_64
CPU Cores: 4
Memory: 15.32 GiB
Swap: 15.31 GiB
GPU: None (CUDA not available)

2026-03-15 14:29:28.988 | INFO     | pcleaner.gui.launcher:launch:73 - Using locale es_MX.
2026-03-15 14:29:28.989 | DEBUG    | pcleaner.gui.launcher:launch:80 - Loaded built-in Qt translations for es_MX.
2026-03-15 14:29:28.989 | DEBUG    | pcleaner.gui.launcher:launch:88 - Loaded built-in Qt base translations for es_MX.
2026-03-15 14:29:29.056 | CRITICAL | pcleaner.gui.launcher:launch:123 - Failed to initialize the main window.
Traceback (most recent call last):

  File "/opt/pipx-panelcleaner/venvs/pcleaner/bin/pcleaner-gui", line 6, in <module>
    sys.exit(main())
    │   │    └ <function main at 0x7f969b1a97a0>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner/gui/launcher.py", line 139, in main
    launch(args.image_path, args.debug)
    │      │                └ {'--debug': False,
    │      │                   '<image_path>': []}
    │      └ {'--debug': False,
    │         '<image_path>': []}
    └ <function launch at 0x7f96bf3d24b0>
> File "/opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner/gui/launcher.py", line 119, in launch
    window = MainWindow(config, files_to_open, debug)
             │          │       │              └ False
             │          │       └ []
             │          └ Config(locale=None, current_profile=Profile(general=GeneralConfig(notes='', preferred_file_type=None, preferred_mask_file_typ...
             └ <class 'pcleaner.gui.mainwindow_driver.MainWindow'>
  File "/opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner/gui/mainwindow_driver.py", line 134, in __init__
    self.ensure_models_downloaded()
    │    └ <function MainWindow.ensure_models_downloaded at 0x7f969b1828d0>
    └ <pcleaner.gui.mainwindow_driver.MainWindow(0x561c8c292940, name="MainWindow") at 0x7f969b027bc0>
  File "/opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner/gui/mainwindow_driver.py", line 445, in ensure_models_downloaded
    has_ocr = md.is_ocr_downloaded()
              │  └ <function is_ocr_downloaded at 0x7f96ceea80f0>
              └ <module 'pcleaner.model_downloader' from '/opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner/model_d...
  File "/opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner/model_downloader.py", line 241, in is_ocr_downloaded
    return get_ocr_model_directory().is_dir()
           └ <function get_ocr_model_directory at 0x7f96c72cfed0>
  File "/opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner/model_downloader.py", line 230, in get_ocr_model_directory
    cache_dir = Path(file_utils.default_cache_path)
                │    └ <module 'transformers.file_utils' from '/opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/transformers/file_...
                └ <class 'pathlib.Path'>

AttributeError: module 'transformers.file_utils' has no attribute 'default_cache_path'

Screenshots
Before
Image
After
Image

Additional context
At first I was only going to report the bug, but I started to investigate and it turns out that it is because

The attribute default_cache_path was removed in recent versions of the transformers library (Hugging Face). PanelCleaner 2.11.9 is using an obsolete API of that library, there is a version incompatibility.
Source: Claude

and by changing
cache_dir = Path(file_utils.default_cache_path)
to
cache_dir = Path(os.getenv("HF_HOME", os.path.join(os.path.expanduser("~"), ".cache", "huggingface")))
at /opt/pipx-panelcleaner/venvs/pcleaner/lib/python3.14/site-packages/pcleaner
the program starts normally

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions