[Error] OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

sun_U·2023년 8월 17일
0

Error

목록 보기
2/2
post-thumbnail

😥 에러 상황

YOLOv8를 사용해 카메라로 영상을 입력받아 Tracking 하는 실습 중 에러 발생.

처음에는 modulenotfounderror: no module named 'lap' 해당 에러가 발생했으나 가상 환경 설정시 파이썬 버전을 3.11로 설정해서 생긴 오류로 3.9로 다시 세팅하니 해결 되었다.

[코드]

import cv2
from ultralytics import YOLO

model = YOLO('yolov8n.pt')

cap = cv2.VideoCapture(0)

while cap.isOpened():
    ret, frame = cap.read()

    if ret :
        results = model.track(frame, persist=True)
        frame = results[0].plot()

    cv2.imshow('tracking', frame)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()

실행 중 이번에는

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
이러한 에러가 발생했다.

해결

설치된 라이브러리들 간에 충돌이 생겨 발생하는 에러이다.

아래의 코드를 추가한 뒤 실행하면 문제 없이 실행되는 것을 확인할 수 있다.

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
profile
Data Engineer AI/ Metaverse :)

1개의 댓글

comment-user-thumbnail
2023년 8월 17일

좋은 글 감사합니다.

답글 달기