0

I'm using the Jupyter notebook extension in VS Code. I'm using Camelot to extract tables from a pdf, and I'm trying to do some visual debugging to find the coordinates of the column separators.

When running:

camelot.plot(tables[1], kind='text').show()

I get the warning: "UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure."

From https://pythonguides.com/matplotlib-is-currently-using-agg-a-non-gui-backend/ I understood the problem is I have no GUI backend. That website suggests using tkinter as the GUI backend. So I did pip install tk to install tkinter into my virtual environment. Then added import to my code: from tkinter import *.

After closing the project folder, exiting VS Code and restarting, when I run

camelot.plot(tables[1], kind='text').show()

I get the same warning: "UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure."

How do I get a GUI backend set up the way matplotlib wants?

2

1 Answer 1

1

Seems there are various solutions, some of which are dated. A solution I found that works as of this post (2022) is

  1. install ipympl to the environment (since I already have jupyter notebook installed in my virtual env, all of the requirements for ipympl were already present, and the only package that needed to be installed was 'ipympl' itself.
  2. add the following code (after import statements): %matplotlib widget

That's it. Now I when I plot something, I get the usual static plot as well as an interactive plot that allows me to see x,y coordinates on the plot as I move the mouse around.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.