Skip to content

-> Cannot close object, library is destroyed. This may cause a memory leak! #1485

@marcobornstein

Description

@marcobornstein

Bug description

I'm trying to run an example of doctr on my M1 Mac. Code is shown farther below.

Code snippet to reproduce the bug

from doctr.io import DocumentFile
from doctr.models import ocr_predictor
import os
# Let's pick the desired backend
os.environ['USE_TORCH'] = '1'

if __name__ == "__main__":

    model = ocr_predictor(pretrained=True)

    # PDF
    doc = DocumentFile.from_pdf("marco-test-2.pdf")

    # Analyze
    result = model(doc)
    # result.show(doc)

Error traceback

`-> Cannot close object, library is destroyed. This may cause a memory leak!`

Environment

DocTR version: v0.7.0
TensorFlow version: N/A
PyTorch version: 2.2.0 (torchvision 0.17.0)
OpenCV version: 4.9.0
OS: Mac OSX 14.3
Python version: 3.11.8
Is CUDA available (TensorFlow): N/A
Is CUDA available (PyTorch): No
CUDA runtime version: Could not collect
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect

Deep Learning backend

print(f"is_tf_available: {is_tf_available()}")
is_tf_available: False
print(f"is_torch_available: {is_torch_available()}")
is_torch_available: True

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions