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

AttributeError: module 'PIL.Image' has no attribute 'Resampling' #1224

Open
pierrelebests opened this issue Mar 9, 2024 · 2 comments
Open

Comments

@pierrelebests
Copy link

Hello,

I'm encountering an issue while using EasyOCR on my system. Despite updating Pillow to the recommended version, I still receive the following error when executing my script:

Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU. Traceback (most recent call last): File "/Users/pierreburianne/Desktop/import easyocr.py", line 3, in <module> result = reader.readtext('/Users/pierreburianne/Downloads/similar_frame_0.jpg') File "/Users/pierreburianne/Library/Python/3.9/lib/python/site-packages/easyocr/easyocr.py", line 468, in readtext result = self.recognize(img_cv_grey, horizontal_list, free_list,\ File "/Users/pierreburianne/Library/Python/3.9/lib/python/site-packages/easyocr/easyocr.py", line 383, in recognize image_list, max_width = get_image_list(h_list, f_list, img_cv_grey, model_height = imgH) File "/Users/pierreburianne/Library/Python/3.9/lib/python/site-packages/easyocr/utils.py", line 613, in get_image_list crop_img,ratio = compute_ratio_and_resize(crop_img,width,height,model_height) File "/Users/pierreburianne/Library/Python/3.9/lib/python/site-packages/easyocr/utils.py", line 576, in compute_ratio_and_resize img = cv2.resize(img,(int(model_height*ratio),model_height),interpolation=Image.Resampling.LANCZOS) File "/Users/pierreburianne/Library/Python/3.9/lib/python/site-packages/PIL/Image.py", line 77, in __getattr__ raise AttributeError(f"module '{__name__}' has no attribute '{name}'") AttributeError: module 'PIL.Image' has no attribute 'Resampling'

Environment:

Python version: 3.9.6
EasyOCR version: 1.7.1
Pillow version: 9.5.0
I've tried updating Pillow, reinstalling libraries, and even recreating my virtual environment, but the issue persists.

Could you please assist me in resolving this issue?

Thank you very much for your help.

@Develop707
Copy link

@rakesh-nj
Copy link

I was also encountering same error ,upgraded Pillow and now it has resolved .
pip install --upgrade Pillow

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

3 participants