Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8177547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:32:11+00:00 2026-06-06T23:32:11+00:00

I am trying to test if Matplotlib works in PyQt on Ubuntu. I have

  • 0

I am trying to test if Matplotlib works in PyQt on Ubuntu. I have been working with PyQt and I want to embed Matplotlib in Pyqt. I followed the code given at http://eli.thegreenplace.net/2009/01/20/matplotlib-with-pyqt-guis/ but It generates some errors while importing the matplotlib.

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_qt4agg.py", line 9, in <module>
    from matplotlib.figure import Figure
  File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 18, in <module>
    from axes import Axes, SubplotBase, subplot_class_factory
  File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 2, in <module>
    import math, sys, warnings, datetime, new
  File "/home/kasa/Desktop/new.py", line 25, in <module>
    from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
ImportError: cannot import name FigureCanvasQTAgg

I run these import commands from terminal and it works fine.
Can someone figure out whats wrong with my installation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:32:12+00:00Added an answer on June 6, 2026 at 11:32 pm

    Read the traceback.

    You tried to import FigureCanvasQTAgg from backend_qt4agg:

    from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
    

    It tried to import Figure from figure:

      File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_qt4agg.py", line 9, in <module>
        from matplotlib.figure import Figure
    

    which tried to import several things from axes:

      File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 18, in <module>
        from axes import Axes, SubplotBase, subplot_class_factory
    

    It imports several modules as well. Notice the last one, new:

      File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 2, in <module>
        import math, sys, warnings, datetime, new
    

    and where does it look for it? Instead of the built-in module, it goes to

      File "/home/kasa/Desktop/new.py", line 25, in <module>
    

    which, I suppose is your file and it goes back again:

        from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
    

    Python realizes that it can’t import FigureCanvasQTAgg because it finds itself in a circular import hell, thus the error:

    ImportError: cannot import name FigureCanvasQTAgg
    

    Long story short

    Your file masks the built-in new module. Solution is simple: Rename the file (and also remove the new.pyc from the folder).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just trying to test for equality in this piece of code, but getting a
I'm trying to test if the xml file have the tag <group> var xmlhttp
I am trying to test some DAOs. I have Entity (and table) named Nomination
I'm trying to test some TPL dataflow code and run into what looks like
I'm trying to test jasperreport and wrote Java code but it giving me error:
I'm trying to test a php file from a C program(...) Basically I have
I'm trying to test a utility method I have that creates urlencoded query strings.
I'm trying to test a method I have in my application, but I don't
In trying to test some sign-in/out functionality I want to delete some information from
I 've been trying to test the place parameter when used for searching post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.