Skip to content

[Bug]: ImportError: cannot import name 'OpenVINOInferencer' #2140

@ZJDATY

Description

@ZJDATY

Install from source

https://github.com/openvinotoolkit/anomalib.git

version:1.2 dev

from anomalib.deploy import OpenVINOInferencer

error

from anomalib.deploy import OpenVINOInferencer, ExportType
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/init.py", line 7, in
from .inferencers import Inferencer, OpenVINOInferencer, TorchInferencer
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/inferencers/init.py", line 7, in
from .openvino_inferencer import OpenVINOInferencer
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/inferencers/openvino_inferencer.py", line 26, in
import openvino as ov
File "/home/zhang/pythonworkspace/py310/results/weights/onnx/openvino.py", line 11, in
from anomalib.deploy import OpenVINOInferencer, ExportType
ImportError: cannot import name 'OpenVINOInferencer' from partially initialized module 'anomalib.deploy' (most likely due to a circular import) (/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/init.py)

I also tried writing like this

from anomalib.deploy.inferencers import OpenVINOInferencer

error

from anomalib.deploy.inferencers import OpenVINOInferencer
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/init.py", line 7, in
from .inferencers import Inferencer, OpenVINOInferencer, TorchInferencer
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/inferencers/init.py", line 7, in
from .openvino_inferencer import OpenVINOInferencer
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/inferencers/openvino_inferencer.py", line 26, in
import openvino as ov
File "/home/zhang/pythonworkspace/py310/results/weights/onnx/openvino.py", line 4, in
from anomalib.deploy.inferencers import OpenVINOInferencer
ImportError: cannot import name 'OpenVINOInferencer' from partially initialized module 'anomalib.deploy.inferencers' (most likely due to a circular import) (/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/inferencers/init.py)

I also tried writing like this
from anomalib.deploy.inferencers.openvino_inferencer import OpenVINOInferencer

error

from anomalib.deploy.inferencers.openvino_inferencer import OpenVINOInferencer
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/init.py", line 7, in
from .inferencers import Inferencer, OpenVINOInferencer, TorchInferencer
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/inferencers/init.py", line 7, in
from .openvino_inferencer import OpenVINOInferencer
File "/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/inferencers/openvino_inferencer.py", line 26, in
import openvino as ov
File "/home/zhang/pythonworkspace/onnx/openvino.py", line 4, in
from anomalib.deploy.inferencers.openvino_inferencer import OpenVINOInferencer
ImportError: cannot import name 'OpenVINOInferencer' from partially initialized module 'anomalib.deploy.inferencers.openvino_inferencer' (most likely due to a circular import) (/home/zhang/pythonworkspace/py310/anomalib/src/anomalib/deploy/inferencers/openvino_inferencer.py)

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