plotnine: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail

I am trying to use plotnine to generate some graphs. I import the required libraries:

from plotnine import *
from plotnine.data import mpg

And then, if I run the following code in PyCharm I get a Warning message, the window plot shows a "No answer" message and I am forced to restart the python terminal:

(ggplot(mpg)         # defining what data to use
 + aes(x='class')    # defining what variable to use
 + geom_bar(size=20) # defining the type of plot to use
)

<ggplot: (150517199824)>
C:\Users\alvaromc317\miniconda3\envs\general\lib\site-packages\plotnine\ggplot.py:363: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.

However, If I start a python terminal from windows cmd terminal and run the same script as before, I get no error message and I see the plot with no problem.

What is happening and how do I get to use plotnine in pycharm?

In case it is needed, I work using a Windows 10 machine and python 3x based on miniconda.

Upvotes: 3

Views: 4729

Answers (1)

Ethan Wicker
Ethan Wicker

Reputation: 554

I'm having a similar problem, but on MacOS using the commercial addition of PyCharm.

From this github issue and this JetBrains issue, it looks like it might be related to a PyCharm bug.

Upvotes: 1

Related Questions