tctianchi / pyvenn

2 ~ 6 sets venn diagram for python
The Unlicense
316 stars 119 forks source link

matplotlib is currently using a non-GUI backend ERROR #3

Closed AgustinPardo closed 6 years ago

AgustinPardo commented 6 years ago

Hello, I'm trying to run the first code lines of the tutorial:

import matplotlib matplotlib.use('Agg') import venn labels = venn.get_labels([ range(10), range(5, 15) ], fill=['number', 'logic']) print labels fig, ax = venn.venn2(labels, names=['list 1', 'list 2']) fig.show()

And I recibe this error:

/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py:459: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure "matplotlib is currently using a non-GUI backend, "

Do you know what is the problem and how to solve it?

osp-ng commented 6 years ago

The error message seems to imply that you are working in a headless console. So fig.show() is meaningless. Are you looking for:

fig.savefig('demo.png', bbox_inches='tight')

AgustinPardo commented 6 years ago

That worked out!

L7c8ana commented 5 years ago

If UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. % get_backend())

and using import matplotlib

Agg backend runs without a display

matplotlib.use('Agg')
import matplotlib.pyplot as plt

Use fig.savefig('demo.pdf')

Hu-Charles commented 5 years ago

it doesnt work

rchuso commented 5 years ago

Try this: matplotlib.use( 'tkagg' )

ash-aldujaili commented 5 years ago
%matplotlib inline
eavelardev commented 5 years ago

install python-tk or python3-tk for python3

sudo apt install python3-tk

LakshyaKhatri commented 5 years ago

install python-tk or python3-tk for python3

sudo apt install python3-tk

Perfect :+1:

ericnjogu commented 5 years ago
%matplotlib inline

Works great with jupyter notebook

marwa9 commented 4 years ago

import cv2 ... fig.show() cv2.waitKey(0)

https://www.pyimagesearch.com/2015/08/24/resolved-matplotlib-figures-not-showing-up-or-displaying/

san-qi commented 4 years ago

install python-tk or python3-tk for python3

sudo apt install python3-tk

nice

godabavinay commented 4 years ago

install python-tk or python3-tk for python3

sudo apt install python3-tk

Thanks it worked.

Mirocle007 commented 4 years ago

Try this: matplotlib.use( 'tkagg' )

Thanks it worked.

Villjoie commented 3 years ago

Thanks it worked!

gregory-volkov commented 3 years ago

I was using venv with several versions of Python installed in VM. Installing python3-tk did not work. But installing the PyQt5 via pip solved this problem for me:

pip install PyQt5
neurosignal commented 3 years ago

Just give the command: %matplotlib qt5

if qt5 is not available, install it first as: pip install PyQt5

BoyalSuhail commented 3 years ago

Hello sir I want to run this code but I'm unable to run this code sir can you help me from beginning...

BoyalSuhail commented 3 years ago

![Uploading IMG20211107184632.jpg…] this type of errors shows when I copy the code and run in Jupiter notebook

neomiraculous commented 11 months ago

install python-tk or python3-tk for python3

sudo apt install python3-tk

God bless you!!! problem solved.