0

I have those errors when i'm trying to import the matplotlib. How can i fix this?

I have install matplotlib with the pip install matplotlib and this was a succes. But when i import the package i have this kind of error. i see it is in the init block but how can i fix this?

i have already tried the pip matplotlib upgrade but this keeps the same problem. i just have matplotlib uninstalled and back installed and it is the same problem.

My code:

import matplotlib.pyplot as plt

Error:

Traceback (most recent call last):
  File "C:\Python27\TEST.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 26, in <module>
    from matplotlib.figure import Figure, figaspect
  File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 24, in <module>
    import matplotlib.artist as martist
  File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 7, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox, \
  File "C:\Python27\lib\site-packages\matplotlib\transforms.py", line 35, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: DLL load failed: %1 is geen geldige Win32-toepassing

I have tried another code, that I found in the comments. But this generate my another error code.

Code :

import matplotlib as mpl
mpl.use('TkAgg')
import matplotlib.pyplot as plt

Error:

Traceback (most recent call last):
  File "C:\Python27\TEST.py", line 1, in <module>
    import matplotlib as mpl
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 1097, in <module>
    rcParams = rc_params()
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 933, in rc_params
    fname = matplotlib_fname()
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 781, in matplotlib_fname
    for fname in gen_candidates():
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 770, in gen_candidates
    yield os.path.join(six.moves.getcwd(), 'matplotlibrc')
AttributeError: '_MovedItems' object has no attribute 'getcwd'

Error Little test program

  • I don't speak Dutch but the error message seems to be saying that it tried to load a DLL but failed. I'm guessing Matplotlib or one of its dependencies is incorrectly or incompletely installed. Can you review how you installed it? – tripleee Feb 08 '18 at 11:27
  • If you are doing new development you should definitely be targetting Python 3 now. Python 2 was originally supposed to go end-of-life a couple of months from now, though it got another two years of additional artificial resuscitation. – tripleee Feb 08 '18 at 11:28
  • Thing like that usually happen if you do not have the correct binaries installed. E.g. using matplotlib built for a 32-bit system on a 64bit python or vice versa. We have no information about your system etc. available here, so it's hard to judge on that. – ImportanceOfBeingErnest Feb 08 '18 at 13:48
  • I have install matplotlib with: pip install matplotlib.. Otherwise I have a 64 bit PC en installed Python 64 bit. – B. De Wilde Feb 09 '18 at 04:42

1 Answers1

0

A "p" seems to be missing from "pyplot". You have pylot instead of pyplot in the import statement.

PaW
  • 659
  • 4
  • 7