You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm pulling my hair out trying to get easyocr working with Python 3.13 on Windows 11. I keep getting the dreaded ModuleNotFoundError: No module named 'torch.backends' error, even though everything seems to be installed correctly. I've spent days on this, and I'm at a complete loss.
The Core Problem:
I'm trying to use easyocr, which depends on PyTorch (torch). My script fails with the ModuleNotFoundError, meaning easyocr can't find the torch.backends module. This happens despite pip showing all required packages (easyocr, torch, torchvision) as installed. The problem seems specific to my main Python 3.13 installation.
What I've Tried (A LOT):
I've tried a ton of things, so I'll try to keep this organized:
Initial Tesseract Issues (Abandoned): I originally tried pytesseract, but Tesseract was a nightmare to configure. I switched to easyocr to avoid that mess.
easyocr Installation: I used pip install easyocr. This should have installed all dependencies, including PyTorch.
Made sure those paths are at the top of the PATH list (or at least before any other Python installations).
IMPORTANT NOTE:where python returns nothing, which is a huge red flag!
Interpreter Checks:
Used the full path to my Python 3.13 executable: & "C:\Users\Mohammad\AppData\Local\Programs\Python\Python313\python.exe" "F:\..."
This lets the script start, but the ModuleNotFoundError still happens.
site-packages Inspection:
Looked in C:\Users\Mohammad\AppData\Local\Programs\Python\Python313\Lib\site-packages for conflicting torch installations or weird files. Didn't find anything obvious.
Reinstalling Everything: Uninstalling and reinstalling easyocr and torch multiple times. No change.
What I HAVEN'T Done (Yet - and this is probably crucial):
Portable Python Test: I haven't yet tested with a portable Python installation to isolate whether the issue is system-wide or specific to my main Python 3.13 install. This is probably my next step.
Check module __file__ attributes: I haven't definitively figured out which specific torch module Python is actually trying to load. I should run this inside the Python 3.13 interpreter (using the full path):
ModuleNotFoundError persists, no matter what I try.
Python interpreter is reachable (with the full path).
where python returns nothing - major PATH issue.
Haven't ruled out conflicting packages or a corrupted PyTorch installation within my main Python 3.13.
haven't ruled out that it is a system wide problem
I'm really hoping someone has seen this before or has some fresh ideas. I'm desperate! Any help would be massively appreciated. I feel like I'm missing something obvious.
TL;DR:ModuleNotFoundError: No module named 'torch.backends' with easyocr and Python 3.13 on Windows 11, despite extensive troubleshooting (PATH, versions, reinstalls, etc.). Haven't done a portable Python test or checked __file__ attributes yet. Help!
The text was updated successfully, but these errors were encountered:
Hello guys,
I'm pulling my hair out trying to get easyocr working with Python 3.13 on Windows 11. I keep getting the dreaded
ModuleNotFoundError: No module named 'torch.backends'
error, even though everything seems to be installed correctly. I've spent days on this, and I'm at a complete loss.The Core Problem:
I'm trying to use easyocr, which depends on PyTorch (torch). My script fails with the
ModuleNotFoundError
, meaning easyocr can't find thetorch.backends
module. This happens despite pip showing all required packages (easyocr, torch, torchvision) as installed. The problem seems specific to my main Python 3.13 installation.What I've Tried (A LOT):
I've tried a ton of things, so I'll try to keep this organized:
Initial Tesseract Issues (Abandoned): I originally tried pytesseract, but Tesseract was a nightmare to configure. I switched to easyocr to avoid that mess.
easyocr Installation: I used
pip install easyocr
. This should have installed all dependencies, including PyTorch.PyTorch Shenanigans:
pip install torch
(CPU version). pip says it's already installed.import torch; print(torch.__version__)
- PyTorch seems to be installed.torch
,torchvision
, andeasyocr
based on Stack Overflow suggestions. No luck.Environment Variable Voodoo:
TESSDATA_PREFIX
is irrelevant (since I'm not using Tesseract anymore).PATH
environment variable. It should include:C:\Users\Mohammad\AppData\Local\Programs\Python\Python313
C:\Users\Mohammad\AppData\Local\Programs\Python\Python313\Scripts
PATH
list (or at least before any other Python installations).where python
returns nothing, which is a huge red flag!Interpreter Checks:
& "C:\Users\Mohammad\AppData\Local\Programs\Python\Python313\python.exe" "F:\..."
ModuleNotFoundError
still happens.site-packages Inspection:
C:\Users\Mohammad\AppData\Local\Programs\Python\Python313\Lib\site-packages
for conflictingtorch
installations or weird files. Didn't find anything obvious.Reinstalling Everything: Uninstalling and reinstalling
easyocr
andtorch
multiple times. No change.What I HAVEN'T Done (Yet - and this is probably crucial):
torch
module Python is actually trying to load. I should run this inside the Python 3.13 interpreter (using the full path):Summary of the Situation:
ModuleNotFoundError
persists, no matter what I try.where python
returns nothing - major PATH issue.I'm really hoping someone has seen this before or has some fresh ideas. I'm desperate! Any help would be massively appreciated. I feel like I'm missing something obvious.
TL;DR:
ModuleNotFoundError: No module named 'torch.backends'
with easyocr and Python 3.13 on Windows 11, despite extensive troubleshooting (PATH, versions, reinstalls, etc.). Haven't done a portable Python test or checked__file__
attributes yet. Help!The text was updated successfully, but these errors were encountered: