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

GUI not displaying when matplotlib is imported #561

Closed
7 of 9 tasks
Colelyman opened this issue May 19, 2020 · 2 comments
Closed
7 of 9 tasks

GUI not displaying when matplotlib is imported #561

Colelyman opened this issue May 19, 2020 · 2 comments

Comments

@Colelyman
Copy link

Colelyman commented May 19, 2020

  • OS: Mac OS X 10.15.2
  • Python Version: 3.7.0 (installed via Anaconda, thus run with pythonw)
  • Gooey Version: 1.0.3.1
  • Thorough description of problem
    • Expected Behavior: the GUI opens up
    • Actual Behavior: the program just hangs
  • A minimal code example -- preferably copy/pastable in the issue itself (less time figuring out how to run your code == more time debugging!)
from gooey import Gooey, GooeyParser

# import matplotlib.pyplot as plt # hangs when imported here

@Gooey
def main():
    argparser = GooeyParser()
    argparser.add_argument('foo')

    args = argparser.parse_args()

    import matplotlib.pyplot as plt # works as expected when imported here

    print(args.foo)


if __name__ == '__main__':
    main()
  • Screenshot (if visual quirk)
  • Anything else you may think will be helpful

I experienced something quirky when trying to use Gooey with importing matplotlib; when matplotlib is imported at the beginning of the tile no GUI appears, and when it is imported within the scope of main the program works as expected.

The only thing that I can think of is matplotlib polluting the global namespace or something, but that is a complete guess.
It is obviously not a high priority issue (due to the easy workaround), but I guess there could be something sinister going on under the covers.
Has anyone else encountered this issue?

Thanks! ^_^

@chriskiehl
Copy link
Owner

Interesting. Which matplotlib version are you using?

I tried running my dev build using the latest matplotlib and it fails with the error:

implement_array_function method already has a docstring

Are you seeing any error messages?

I see this this numpy issue related to the failure. In short, it doesn't like being re-initialized due to its use of globals. Seems quite a few libraries are affected by it. Per an update on that issue a few days ago, it's something they're working on fixing.

FWIW, I downgraded to matplotlib==3.1.3 and everything played nicely again.

@Colelyman
Copy link
Author

Oh interesting, I was at matplotlib==3.0.2 but upgraded up to matplotlib==3.1.3 and everything worked.

I'm not seeing any error messages, but I think that is due to me being at an older version of matplotlib.
Thanks for your help and for Gooey!
It is a fantastic tool that I use frequently.

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