8

Tried to solve it with :

pip install -U numpy

but it still does not work.

That is what the console shows to me when I try to run the application :

    RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
  File "/Users/Rubio/Desktop/logistic-regression/train.py", line 8, in <module>
    import cv2
  File "/Library/Python/2.7/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import
KiririIG
  • 321
  • 2
  • 5
  • 11

6 Answers6

1

Uninstall & Install Numpy

conda uninstall numpy

conda install -c conda-forge numpy

it works

DoEvent
  • 11
  • 1
1

I had a file named numbers.py in the same folder. Removing this file solved the issue for me.

Very strange, but worked.

Ebin Zacharias
  • 195
  • 1
  • 7
1

Two solutions. I faced this problem with ai2thor environment.

  1. Just add import numpy.core.multiarray before the import cv2 statement
  2. Update number: pip install -U --no-cache-dir numpy==1.19.3
John Doe
  • 2,173
  • 1
  • 21
  • 12
0

Reinstall OpenCV:

conda install -c anaconda opencv (for anaconda users)
Blue
  • 22,608
  • 7
  • 62
  • 92
0

I discovered that my problem was that I had two versions of numpy installed, I uninstall one of them and it worked normal.

0

I faced this error with Tello Drone "DJITelloPy" and this solution from Soroush Karimi saved the day.

pip uninstall numpy
pip install numpy==1.19.3
HassanSh__3571619
  • 1,859
  • 1
  • 19
  • 18