Goodman-lab / DP5

Python workflow for DP5 and DP4 analysis of organic molecules
Other
173 stars 99 forks source link

ModuleNotFoundError: No module named 'matplotlib.backends.backend_qt4agg' #67

Closed quochung2310 closed 1 year ago

quochung2310 commented 1 year ago

I am trying this command: python PyDP4_GUI.py

Then error showed: Traceback (most recent call last): File "/home/duc/DP5/PyDP4_GUI.py", line 8, in <module> from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas ModuleNotFoundError: No module named 'matplotlib.backends.backend_qt4agg' (Sorry, I don't know how to insert line break inside the block code) Run command: sudo apt-get install python-matplotlib-qt4

Resulted in error: E: Unable to locate package python-matplotlib-qt4

My pc is Kubuntu 22.04 Any suggestion please? Thank you very much!

quochung2310 commented 1 year ago

Ok, I solved it after several steps. However, I am not sure which one is the key solution ^^

First, I tried to install PyQT4 using this method: https://ubuntuhandbook.org/index.php/2020/07/install-qt4-ubuntu-20-04/

Run again, but it still showed the same error

Second: Edit PyDP4_GUI.py file with text editor, then change line 8 matplotlib.backends.backend_qt4agg to matplotlib.backends.backend_qt5agg

Then it worked ^^!

P/s: for anyone failed for other reasons (i.e. some modules not found), try to install them with command pip install I wrote this line for Linux beginners like me ^^

Jonathan-Goodman commented 1 year ago

I think the issue here may be the version of matplotlib.

This runs fine for me with matplotlib 3.4.3 The latest version has changed: https://matplotlib.org/stable/api/backend_qt_api.html

If you have the latest version, might try changing the import statement to: from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qtagg import NavigationToolbar2QT as NavigationToolbar

Does it fix the problem?

Jonathan

From: quochung2310 @.> Reply to: Goodman-lab/DP5 @.> Date: Thursday, 18 August 2022 at 05:00 To: Goodman-lab/DP5 @.> Cc: Subscribed @.> Subject: [Goodman-lab/DP5] ModuleNotFoundError: No module named 'matplotlib.backends.backend_qt4agg' (Issue #67)

I am trying this command: python PyDP4_GUI.py

Then error showed: Traceback (most recent call last): File "/home/duc/DP5/PyDP4_GUI.py", line 8, in from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas ModuleNotFoundError: No module named 'matplotlib.backends.backend_qt4agg'

Run command: sudo apt-get install python-matplotlib-qt4

Resulted in error: E: Unable to locate package python-matplotlib-qt4

My pc is Kubuntu 22.04 Any suggestion please? Thank you very much!

— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGoodman-lab%2FDP5%2Fissues%2F67&data=05%7C01%7Cjmg11%40universityofcambridgecloud.onmicrosoft.com%7C460279eb366040ea5c9608da80ce2362%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637963920085777324%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=aLKpLuXCCtRhKxHMf5vut5NfL4Q87D0mQah77wtWeFg%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFCYOVWMR4IN3UHNF4EKL6LVZWYMJANCNFSM563VXGJQ&data=05%7C01%7Cjmg11%40universityofcambridgecloud.onmicrosoft.com%7C460279eb366040ea5c9608da80ce2362%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637963920085777324%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8VXqiZwOw2clrqbOw95ATTteERqLFOMKUg1%2BRscn1qw%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>