Fixed Error "Could not load the Qt platform plugin "xcb" mentioned in #101

This commit is contained in:
Deniz Şafak
2025-12-09 04:24:38 +03:00
parent ed31aaf632
commit e3cdd1a9ca
5 changed files with 33 additions and 2 deletions
+2
View File
@@ -1,7 +1,9 @@
# 1.2.5 (Pre-release) # 1.2.5 (Pre-release)
- Fixed `Error "Could not load the Qt platform plugin "xcb"` error that occurred in some Linux distributions due to missing `libxcb-cursor0` library by conditionally loading the bundled library when the system version is unavailable, issue mentioned by @bmcgonag in #101.
- Fixed the `No module named pip` error that occurred for users who installed Abogen via the [**uv**](https://github.com/astral-sh/uv) installer. - Fixed the `No module named pip` error that occurred for users who installed Abogen via the [**uv**](https://github.com/astral-sh/uv) installer.
- Fixed defaults for `replace_single_newlines` not being applied correctly in some cases. - Fixed defaults for `replace_single_newlines` not being applied correctly in some cases.
- Fixed `Save chapters separately for queued epubs is ignored`, issue mentioned by @dymas-cz in #109. - Fixed `Save chapters separately for queued epubs is ignored`, issue mentioned by @dymas-cz in #109.
- Improvements in code and documentation.
# 1.2.4 # 1.2.4
- **Subtitle generation is now available for all languages!** Abogen now supports subtitle generation for non-English languages using audio duration-based timing. Available modes include `Line`, `Sentence`, and `Sentence + Comma`. (Note: Word-level subtitle modes remain English-only due to Kokoro's timestamp token limitations.) - **Subtitle generation is now available for all languages!** Abogen now supports subtitle generation for non-English languages using audio duration-based timing. Available modes include `Line`, `Sentence`, and `Sentence + Comma`. (Note: Word-level subtitle modes remain English-only due to Kokoro's timestamp token limitations.)
Binary file not shown.
Binary file not shown.
+25 -2
View File
@@ -3,6 +3,8 @@ import sys
import platform import platform
import atexit import atexit
import signal import signal
from abogen.utils import get_resource_path, load_config, prevent_sleep_end
# Fix PyTorch DLL loading issue ([WinError 1114]) on Windows before importing PyQt6 # Fix PyTorch DLL loading issue ([WinError 1114]) on Windows before importing PyQt6
if platform.system() == "Windows": if platform.system() == "Windows":
@@ -21,6 +23,7 @@ if platform.system() == "Windows":
except Exception: except Exception:
pass pass
# Qt platform plugin detection (fixes #59) # Qt platform plugin detection (fixes #59)
try: try:
from PyQt6.QtCore import QLibraryInfo from PyQt6.QtCore import QLibraryInfo
@@ -42,6 +45,28 @@ try:
except ImportError: except ImportError:
print("PyQt6 not installed.") print("PyQt6 not installed.")
# Pre-load "libxcb-cursor" on Linux (fixes #101)
if platform.system() == "Linux":
arch = platform.machine().lower()
lib_filename = {"x86_64": "libxcb-cursor-amd64.so.0", "amd64": "libxcb-cursor-amd64.so.0", "aarch64": "libxcb-cursor-arm64.so.0", "arm64": "libxcb-cursor-arm64.so.0"}.get(arch)
if lib_filename:
import ctypes
try:
# Try to load the system libxcb-cursor.so.0 first
ctypes.CDLL('libxcb-cursor.so.0', mode=ctypes.RTLD_GLOBAL)
except OSError:
# System lib not available, load the bundled version
lib_path = get_resource_path('abogen.libs', lib_filename)
if lib_path:
try:
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
except OSError:
# If it fails (e.g. wrong glibc version on very old systems),
# we simply ignore it and hope the system has the library.
pass
# Set application ID for Windows taskbar icon # Set application ID for Windows taskbar icon
if platform.system() == "Windows": if platform.system() == "Windows":
try: try:
@@ -64,8 +89,6 @@ from PyQt6.QtCore import (
# Add the directory to Python path # Add the directory to Python path
sys.path.insert(0, os.path.join(os.path.dirname(__file__))) sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
from abogen.utils import get_resource_path, load_config, prevent_sleep_end
# Set Hugging Face Hub environment variables # Set Hugging Face Hub environment variables
os.environ["HF_HUB_DISABLE_TELEMETRY"] = "1" # Disable Hugging Face telemetry os.environ["HF_HUB_DISABLE_TELEMETRY"] = "1" # Disable Hugging Face telemetry
os.environ["HF_HUB_ETAG_TIMEOUT"] = "10" # Metadata request timeout (seconds) os.environ["HF_HUB_ETAG_TIMEOUT"] = "10" # Metadata request timeout (seconds)
+6
View File
@@ -65,9 +65,15 @@ exclude = [
"WINDOWS_INSTALL.bat", "WINDOWS_INSTALL.bat",
] ]
[tool.hatch.build.targets.sdist.force-include]
"abogen/libs" = "abogen/libs"
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
packages = ["abogen"] packages = ["abogen"]
[tool.hatch.build.targets.wheel.force-include]
"abogen/libs" = "abogen/libs"
[tool.hatch.version] [tool.hatch.version]
path = "abogen/VERSION" path = "abogen/VERSION"
pattern = "^(?P<version>.+)$" pattern = "^(?P<version>.+)$"