mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
Fixed [WinError 1114] A dynamic link library (DLL) initialization routine failed, Potential fix for CUDA GPU is not available
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
# 1.2.2 (pre-release)
|
||||||
|
- Fixed `[WinError 1114] A dynamic link library (DLL) initialization routine failed` error on Windows, pre-loading PyTorch DLLs before initializing PyQt6 to avoid DLL initialization errors, mentioned in #98 by @ephr0n.
|
||||||
|
- Potential fix for `CUDA GPU is not available` issue, by ensuring PyTorch is installed correctly with CUDA support on Windows using the installer script.
|
||||||
|
|
||||||
# 1.2.1
|
# 1.2.1
|
||||||
- Upgraded Abogen's interface from PyQt5 to PyQt6 for better compatibility and long-term support.
|
- Upgraded Abogen's interface from PyQt5 to PyQt6 for better compatibility and long-term support.
|
||||||
- Added tooltip indicators in queue manager to display book handler options (`Save chapters separately` and `Merge chapters at the end`) for queued items.
|
- Added tooltip indicators in queue manager to display book handler options (`Save chapters separately` and `Merge chapters at the end`) for queued items.
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ python -m venv venv
|
|||||||
venv\Scripts\activate
|
venv\Scripts\activate
|
||||||
|
|
||||||
# For NVIDIA GPUs:
|
# For NVIDIA GPUs:
|
||||||
pip install torch==2.8.0 torchaudio==2.8.0 torchvision==0.23.0 --index-url https://download.pytorch.org/whl/cu128
|
pip install torch torchaudio torchvision --index-url https://download.pytorch.org/whl/cu128
|
||||||
|
|
||||||
# For AMD GPUs:
|
# For AMD GPUs:
|
||||||
# Not supported yet, because ROCm is not available on Windows. Use Linux if you have AMD GPU.
|
# Not supported yet, because ROCm is not available on Windows. Use Linux if you have AMD GPU.
|
||||||
|
|||||||
+2
-4
@@ -279,8 +279,7 @@ if /I "%IS_NVIDIA%"=="true" (
|
|||||||
|
|
||||||
if "%cuda_available%"=="False" (
|
if "%cuda_available%"=="False" (
|
||||||
echo Installing PyTorch with CUDA (12.8) support...
|
echo Installing PyTorch with CUDA (12.8) support...
|
||||||
:: Temporarily set the PyTorch version to 2.0.8 to prevent [WinError 1114] error.
|
%PYTHON_CONSOLE_PATH% -m pip install torch torchaudio torchvision --index-url https://download.pytorch.org/whl/cu128 --no-warn-script-location
|
||||||
%PYTHON_CONSOLE_PATH% -m pip install torch==2.8.0 torchaudio==2.8.0 torchvision==0.23.0 --extra-index-url https://download.pytorch.org/whl/cu128 --no-warn-script-location
|
|
||||||
echo.
|
echo.
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo Failed to install PyTorch.
|
echo Failed to install PyTorch.
|
||||||
@@ -304,8 +303,7 @@ if /I "%IS_NVIDIA%"=="true" (
|
|||||||
echo Skipping PyTorch installation.
|
echo Skipping PyTorch installation.
|
||||||
) else (
|
) else (
|
||||||
echo Installing PyTorch with CUDA (12.8) support...
|
echo Installing PyTorch with CUDA (12.8) support...
|
||||||
:: Temporarily set the PyTorch version to 2.0.8 to prevent [WinError 1114] error.
|
%PYTHON_CONSOLE_PATH% -m pip install torch torchaudio torchvision --index-url https://download.pytorch.org/whl/cu128 --no-warn-script-location
|
||||||
%PYTHON_CONSOLE_PATH% -m pip install torch==2.8.0 torchaudio==2.8.0 torchvision==0.23.0 --extra-index-url https://download.pytorch.org/whl/cu128 --no-warn-script-location
|
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo Failed to install PyTorch.
|
echo Failed to install PyTorch.
|
||||||
pause
|
pause
|
||||||
|
|||||||
@@ -4,6 +4,24 @@ import platform
|
|||||||
import atexit
|
import atexit
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
|
# Fix PyTorch DLL loading issue on Windows before importing PyQt6
|
||||||
|
if platform.system() == "Windows":
|
||||||
|
import ctypes
|
||||||
|
import site
|
||||||
|
|
||||||
|
for site_path in site.getsitepackages():
|
||||||
|
torch_lib_path = os.path.join(site_path, "torch", "lib")
|
||||||
|
if os.path.exists(torch_lib_path):
|
||||||
|
# Pre-load torch DLLs before Qt can interfere
|
||||||
|
for dll in ['c10.dll', 'torch_cpu.dll', 'torch_python.dll']:
|
||||||
|
dll_path = os.path.join(torch_lib_path, dll)
|
||||||
|
if os.path.exists(dll_path):
|
||||||
|
try:
|
||||||
|
ctypes.CDLL(dll_path)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
break
|
||||||
|
|
||||||
# Qt platform plugin detection (fixes #59)
|
# Qt platform plugin detection (fixes #59)
|
||||||
try:
|
try:
|
||||||
from PyQt6.QtCore import QLibraryInfo
|
from PyQt6.QtCore import QLibraryInfo
|
||||||
|
|||||||
@@ -257,6 +257,12 @@ def calculate_text_length(text):
|
|||||||
|
|
||||||
|
|
||||||
def get_gpu_acceleration(enabled):
|
def get_gpu_acceleration(enabled):
|
||||||
|
"""
|
||||||
|
Check GPU acceleration availability.
|
||||||
|
|
||||||
|
Note: On Windows, torch DLLs must be pre-loaded in main.py before PyQt6
|
||||||
|
to avoid DLL initialization errors.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
import torch
|
import torch
|
||||||
from torch.cuda import is_available as cuda_available
|
from torch.cuda import is_available as cuda_available
|
||||||
|
|||||||
Reference in New Issue
Block a user