Search code examples
pythonmatplotlibattributeerror

Matplotlib - AttributeError: 'version_info' object has no attribute '__version__"


I am not sure how to fix this error. I have tried searching everywhere. This error only comes up when I try to interact with matplotlib. My pip is fully upgraded and I am using python 3.6.0 for a class. Thank you!

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import matplotlib Traceback (most recent call last): File "", line 1, in File "C:\Users\syner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib_init_.py", line 107, in from . import cbook, rcsetup File "C:\Users\syner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib\rcsetup.py", line 28, in from matplotlib.fontconfig_pattern import parse_fontconfig_pattern File "C:\Users\syner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\matplotlib\fontconfig_pattern.py", line 15, in from pyparsing import (Literal, ZeroOrMore, Optional, Regex, StringEnd, File "C:\Users\syner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyparsing_init_.py", line 130, in version = version_info.version AttributeError: 'version_info' object has no attribute 'version'


Solution

  • I figured out the solution for my problem. I noticed that just before the AttributeError, it is trying to import pyparsing, so I looked for solutions for that. I stumbled upon a stackoverflow post: unknown version in python library pyparsing

    The answer of installing version 2.4.7 worked for me. Since I am running 2016 software in 2021, I think the newest version was creating problems.

    Thank you!