ImportError: numpy.core.multiarray failed to import

I’m trying to run this program

import cv2
import time

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(0)

while True:
    img = cv.QueryFrame(capture)
    cv.ShowImage("camera", img)
    if cv.WaitKey(10) == 27:
        break
cv.DestroyAllWindows()

But I’m having a problem with numpy, I’m using pyschopy along with opencv. The problem I keep getting is this error report:

RuntimeError: module compiled against API version 7 but this version of numpy is 6

Traceback (most recent call last):

File “C:\Users\John\Documents\EyeTracking\Programs\GetImage.py”, line 1, in

import cv2

ImportError: numpy.core.multiarray failed to import

I have numpy-1.6.1-py2.7 in the psychopy folder, I’m just confused as to what is wrong?

Edit (Deleted Answer)

The following command

pip install -U numpy 

helps solving the problem: could not load numpy.core.multiarray.

Leave a Comment