3

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'

3
  • Try this:import matplotlib;print('matplotlib: {}'.format(matplotlib.__version__)) Commented Feb 1, 2022 at 2:13
  • Thank you for your comment. It still gives the same error and does not print a version. Commented Feb 1, 2022 at 15:41
  • However, when I run 'pip show matplotlib' in the cmd window, it shows 3.3.4 Commented Feb 1, 2022 at 16:28

3 Answers 3

5

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!

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

Comments

0

I found answer for my problem, before that I installed matplotlib for 3.6 then while importing tensorflow also its showing same issue after uninstalles matplotlib then tensorflow working fine.

Comments

0

I had the same issue and found this solution

unknown version in python library pyparsing

It is not Matplotlib that is the problem. It is pyparsing

"Try manually installing pyparsing 2.4.7 using "pip install pyparsing==2.4.7". There are some versioning issues being sorted out, so using the last stable pyparsing version should be of some help."

I installed this pyparsing version and now import matplotlib works.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.