0

I am trying to use Matplotlib in my conda environment (Python 3.6) I am getting this error. Does anyone have an idea how to fix this?

import matplotlib.pyplot as plt

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
   ....
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\tri\triangulation.py in <module>()
  4 import six
  5 
----> 6 import matplotlib._tri as _tri
  7 import matplotlib._qhull as _qhull
  8 import numpy as np

AttributeError: module 'matplotlib' has no attribute '_tri'

Please let me know if I need to post more details of the error.

Georgy
  • 12,464
  • 7
  • 65
  • 73
C.Crumpet
  • 23
  • 1
  • 4
  • Dont you need to import numpy first? – vividpk21 Aug 22 '18 at 01:39
  • 1
    it dosn't seen to be a numpy thing, that makes no difference – C.Crumpet Aug 22 '18 at 01:46
  • I had a similar issue when I was trying to do `import matplotlib` and then access `matplotlib.tri.triangulation.Triangulation` which resulted in an `AttributeError`. Running the following instead: `from matplotlib import tri; tri.triangulation.Triangulation` fixed the issue. This behavior was explained many times before, for example: [Why does this AttributeError in python occur?](https://stackoverflow.com/questions/8696322/why-does-this-attributeerror-in-python-occur) – Georgy Aug 16 '19 at 11:11

2 Answers2

2

I feel like you have mismatched binaries, unfortunately, I can't reproduce your error because mine works.

(1): Perhaps try to uninstall matplotlib and then re-install it again

conda uninstall matplotlib

conda install matplotlib

(2) try the output conda list and conda info then analyze it or post it here maybe so we can analyze it?

(3) Try the following commands maybe they will work:

conda update --all

(4) if this doesn't work uninstall Anaconda maybe and try to reinstall the latest version of it.

0

These type of errors may happen if you install different versions of the matplotlib package with conda and pip. Uninstall both, i.e.pip uninstall matplotlib and conda uninstall matplotlib, and then install it from only one package manager, e.g. conda install matplotlib.

Christian Herenz
  • 505
  • 5
  • 18