Reputation: 690
I try to plot a simple graph in networkx
, but this error message appears:
RuntimeError: module compiled against API version 6 but this version of numpy is 4
Traceback (most recent call last):
File "D:\project\awk\gg.py", line 2, in <module>
import matplotlib.pyplot as plt
File "D:\programs\python\lib\site-packages\matplotlib\pyplot.py", line 26, in <module>
from matplotlib.figure import Figure, figaspect
File "D:\programs\python\lib\site-packages\matplotlib\figure.py", line 24, in <module>
import matplotlib.artist as martist
File "D:\programs\python\lib\site-packages\matplotlib\artist.py", line 7, in <module>
from transforms import Bbox, IdentityTransform, TransformedBbox, \
File "D:\programs\python\lib\site-packages\matplotlib\transforms.py", line 35, in <module>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: numpy.core.multiarray failed to import
How do I solve this?
Upvotes: 1
Views: 1051
Reputation: 3145
The problem is with the API mismatch as stated in the error message. First of all use pip to uninstall numpy.
pip uninstall numpy
Then get the latest binary installer for numpy and matplotlib from here selecting your version of python and windows 32 or 64 bit. Then install it as normal software installer. Make sure it finds your version of python during the installation. This is it !!
Upvotes: 1
Reputation: 87546
You downloaded a binary version of matplotlib
linked/compiled against a newer version of numpy
than you have installed.
Either upgrade your numpy
installation, find a version of matplotlib
compiled against your version of numpy
, or build matplotlib
from the source.
Upvotes: 3