1

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?

7
  • 1
    Can you plot simple graphs, independently of networkx? Commented May 31, 2013 at 10:00
  • Can you import numpy? Commented May 31, 2013 at 15:23
  • please edit the tags to point at the right version of windows. Commented Jun 1, 2013 at 2:33
  • 1
    How did you install NetworkX, and how did you install Numpy? Are you sure that you don't have Matplotlib already installed? Commented Jun 5, 2013 at 6:49
  • 2
    NetworkX isn't the tool for large maps such as social network dumps. And if don't understand your environment you won't go far, just by reusing code, not meant for beginners that aren't even familiar with Python. No need for rush, take it slowly Commented Jun 5, 2013 at 10:02

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

1

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 !!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.