Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't solve the problem, it keeps giving me an OSError every time it's raised. #1252

Open
YuriiTrom opened this issue May 13, 2024 · 1 comment

Comments

@YuriiTrom
Copy link

{
"name": "OSError",
"message": "[WinError 126] The specified module could not be found. Error loading "C:\Users\tromp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\lib\shm.dll" or one of its dependencies.",
"stack": "---------------------------------------------------------------------------
OSError Traceback (most recent call last)
Cell In[2], line 1
----> 1 import easyocr
2 reader = easyocr.Reader(['en'])

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\easyocr\init.py:1
----> 1 from .easyocr import Reader
3 version = '1.7.1'

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\easyocr\easyocr.py:3
1 # -- coding: utf-8 --
----> 3 from .recognition import get_recognizer, get_text
4 from .utils import group_text_box, get_image_list, calculate_md5, get_paragraph,\
5 download_and_unzip, printProgressBar, diff, reformat_input,\
6 make_rotated_img_list, set_result_with_confidence,\
7 reformat_input_batched, merge_to_free
8 from .config import *

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\easyocr\recognition.py:2
1 from PIL import Image
----> 2 import torch
3 import torch.backends.cudnn as cudnn
4 import torch.utils.data

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\init.py:141
139 err = ctypes.WinError(ctypes.get_last_error())
140 err.strerror += f' Error loading "{dll}" or one of its dependencies.'
--> 141 raise err
143 kernel32.SetErrorMode(prev_error_mode)
146 def _preload_cuda_deps(lib_folder, lib_name):

OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\tromp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\torch\lib\shm.dll" or one of its dependencies."
}
/

@Siddharth-Latthe-07
Copy link

The error you’re encountering indicates that there is a missing or corrupted dependency for the torch library, specifically the shm.dll file.
possible causes:-

  1. Ensure All Dependencies are Installed
  2. Update Your Environment
  3. Check for Missing DLL Files
  4. Reinstalling PyTorch with CUDA or CPU-only Versions
  5. Verify Your Python Environment
python -m venv myenv
myenv\Scripts\activate  # On Windows
# myenv/bin/activate    # On MacOS/Linux
pip install easyocr
pip install torch
  1. Check for Conflicting Software
    Ensure that there are no software conflicts, such as multiple versions of Python or other packages that might interfere.
  2. After performing these steps, try running your code again:
import easyocr
reader = easyocr.Reader(['en'])

Hope this helps,
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants