1

I am getting a syntax error when trying to import matplotlib as plt:

python3 sigClassCNN_tensor.py
Traceback (most recent call last):
  File "sigClassCNN_tensor.py", line 22, in <module>
    import matplotlib.pyplot as plt
  File "/usr/lib64/python3.4/site-packages/matplotlib/__init__.py", line 131, in <module>
    from matplotlib.rcsetup import defaultParams, validate_backend, cycler
  File "/usr/lib64/python3.4/site-packages/matplotlib/rcsetup.py", line 29, in <module>
    from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
  File "/usr/lib64/python3.4/site-packages/matplotlib/fontconfig_pattern.py", line 22, in <module>
    from pyparsing import (Literal, ZeroOrMore, Optional, Regex, StringEnd,
  File "/usr/lib/python2.7/site-packages/pyparsing.py", line 2480
    except ParseException, err:

I had this code working before.

Not sure what's changed.

How can I fix it?

6
  • 4
    Looks like it's mixing in python2 files ... Commented May 22, 2018 at 6:00
  • Make sure you have imported and updated all libraries to python3? Commented May 22, 2018 at 6:01
  • Please show a full (including the '#!' if you use one, otherwise the command used to invoke) code that generates this error. Commented May 22, 2018 at 6:04
  • So I have both Python2.7 and Python3.4 on my Centos machine. The code was run using a python3 compiler. From the error message, it looks like pyparsing.py was called using the python2.7 version. why would this be the case? Commented May 24, 2018 at 1:10
  • The original code was really long, include some of tensorflow stuff. But I am certain that it is the matplotlib package that's causing the issue. The code runs without error, if I comment it out. Commented May 24, 2018 at 1:13

0

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.