Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running #1

Closed
starly opened this issue Dec 2, 2019 · 3 comments

Comments

@starly
Copy link

starly commented Dec 2, 2019

Attempting to import MatchingMarkets in Google Codelab environment running Python 3.6 however getting the following error:

import matchingmarkets as mm

ImportError Traceback (most recent call last)
in ()
----> 1 import matchingmarkets as mm
2 #import matplotlib
3 #matplotlib.use('TKAgg')

4 frames
/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py in switch_backend(newbackend)
234 "Cannot load backend {!r} which requires the {!r} interactive "
235 "framework, as {!r} is currently running".format(
--> 236 newbackend, required_framework, current_framework))
237
238 rcParams['backend'] = rcParamsDefault['backend'] = newbackend

ImportError: Cannot load backend 'Qt5Agg' which requires the 'qt5' interactive framework, as 'headless' is currently running


After doing some research on the error, it seems others have had similar error with matplotlib, though it is not clear if the suggested workaround would help in this case.

Any insights would be greatly appreciated.. or alternatively if you happen to have a clean install with MatchingMarkets already working somewhere in an online notebook/environment , please advise where it can be accessed. Thanks.

@VHRanger
Copy link
Collaborator

VHRanger commented Dec 2, 2019

Hey, author of the package here.

I didn't work on this code for a while, I just downloaded it and I'll take a look.

Are all codelab notebook similar to colab notebooks from here: https://colab.research.google.com/ ?

I think the issue is from the interactive plots (like the one at the top of the README) not playing nice with some package versions. I'll update here when I find out.

@starly
Copy link
Author

starly commented Dec 4, 2019

Hi, pardon the typo .. yes, was using a colab environment via the Google link you indicated.

Thank you in advance for taking a look.

@VHRanger
Copy link
Collaborator

The error is specific to colab it seems, because it runs on headless servers, the plotting backend can't work.

I added a bandaid fix so the package can still be imported, but you won't be able to plot the interactive visualizations in the colab environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants