EasyOCR
EasyOCR copied to clipboard
deform_conv_cuda not found in deform_conv
I met same issue trying initializing reader = easyocr.Reader(["en", "de"], detect_network="dbnet18")
File ~/.virtualenvs/py3106/lib/python3.10/site-packages/easyocr/DBNet/assets/ops/dcn/functions/deform_conv.py:5, in <module>
2 from torch.autograd import Function
3 from torch.nn.modules.utils import _pair
----> 5 from .. import deform_conv_cuda
8 class DeformConvFunction(Function):
10 @staticmethod
11 def forward(ctx,
12 input,
(...)
19 deformable_groups=1,
20 im2col_step=64):
ImportError: cannot import name 'deform_conv_cuda' from partially initialized module 'easyocr.DBNet.assets.ops.dcn' (most likely due to a circular import)
I've tried various combinations with
- python 3.7/3.8/3.9/3.10,
- torch 1.7/1.9/1.10/1.12,
- cuda 10.1/11.3/11.6/11.7,
- ubuntu 20.04/22.04,
- via
pip instal easyocr
/withpython compile_dbnet_dcn.py
.
Unfortunately all of them failed at this step.
Anyone managed to get it running? Could you share you env setting and lib versions?
Encountered the same issue
Update: I got it work. The key is:
- nvcc is necessary, so cuda runtime image as base image is not enough. It must be cuda-devel.
- env var CUDA_HOME must be set. It's not enough to have nvcc present under PATH. So set
/usr/local/cuda...
as CUDA_HOME is a must. - After
pip install easyocr
, I still need to go topath/to/lib/easyocr/scripts
and runpython compile_dbnet_dcn.py
. If the above 2 conditions met, this time it works. No matter what cuda/os/torch version combination.
Unfortunately for my use case it seems the shared dbnet18 model works worse than craft (although craft is not perfect either).
Same error here.
Same issue.
hi all, can you try the last version (1.6.2)?
thanx it is work
I solved it with conda install cuda-nvcc