RuntimeError: module compiled against API version 0xa, but this numpy version is 0x9

I am looking at the New Coder API tutorial ( this one ) and received the following error when trying to run the program:

RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9Traceback (most recent call last): File "api.py", line 7, in <module> import matplotlib.pyplot as plt File "/home/crash/TestEnv/venv/local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 27, in <module> import matplotlib.colorbar File "/home/crash/TestEnv/venv/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 32, in <module> import matplotlib.artist as martist File "/home/crash/TestEnv/venv/local/lib/python2.7/site-packages/matplotlib/artist.py", line 12, in <module> from .transforms import Bbox, IdentityTransform, TransformedBbox, \ File "/home/crash/TestEnv/venv/local/lib/python2.7/site-packages/matplotlib/transforms.py", line 39, in <module> from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox, ImportError: numpy.core.multiarray failed to import 

I know that this is not my code, because I also tried to run it with sample code and had the same problem. One of the answers I saw here was to try Numpy 1.8, but that didn't work either.

Also, all this is configured in a virtual environment as directed, so I don't think this is a problem of what I installed elsewhere.

+5
source share
2 answers

Installing packages from the requirements file may cause crashes. I mean something like pip install -r requirements.txt

It seems to me that pip just installs the packages in the order without dependencies (the first line from the file, the second line, ...).

I had the same problem because I installed numpy outside the environment and numpy after matplotlib in requirements.txt Pip compiled matplotlib with system nympy, after which I installed new numpy and nothing worked.

I just switched the lines and installed matplotlib after numpy . Now it works.

+4
source

Try the following:

 pip install numpy --upgrade 

It works for me

+1
source

All Articles