Skip to content

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

Open
@pierreburnn

Description

@pierreburnn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions