Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 772
Álvaro Méndez Civieta Avatar asked Nov 19 '25 10:11

Álvaro Méndez Civieta


1 Answers

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.

like image 185
Ethan Wicker Avatar answered Nov 21 '25 00:11

Ethan Wicker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!