Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

import matplotlib.pyplot as plt -> error

I am getting the following error on the import line in the workspace for matplotlib:

RuntimeError: module compiled against API version 0xc but this version of numpy is 0x9
Traceback (most recent call last):
File "s5v1.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/usr/local/pyenv/versions/3.6.4/lib/python3.6/site-packages/matplotlib/pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "/usr/local/pyenv/versions/3.6.4/lib/python3.6/site-packages/matplotlib/colorbar.py", line 32, in <modul e>
import matplotlib.artist as martist
File "/usr/local/pyenv/versions/3.6.4/lib/python3.6/site-packages/matplotlib/artist.py", line 14, in <module>
from .transforms import (Bbox, IdentityTransform, TransformedBbox,
File "/usr/local/pyenv/versions/3.6.4/lib/python3.6/site-packages/matplotlib/transforms.py", line 39, in <mod ule>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: numpy.core.multiarray failed to import

Is there a reason this library will not import?

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

It appears that numpy.core.multiarray failed to import. Can you confirm if numpy is installed in your environment?

1 Answer

yes, numpy is installed

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

Can you start the Python REPL and import numpy? This should be error free:

$ python
Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>