matplotlib equivalent for Ubuntu servers with no GUI?
NickName:D. Silverstone Ask DateTime:2016-11-13T10:44:25

matplotlib equivalent for Ubuntu servers with no GUI?

I have a GUI-less cloud server running Bitnami-Django Ubuntu 14.04 LTS that is meant to retrieve and graph data for users, but it cannot produce the graphs. To be clear, I only care that the graph image is produced and saved, not that a user has an option to click a button to save the image. Such functionality would be meaningless for such a server.

On my normal Ubuntu Linux (Mate) 14.04 LTS, the scripts work perfectly, producing a matplotlib.pyplot from the relevant data in a GUI window with save, zoom, rotate and other functionality; however on the cloud server I get this error, even if I don't try to invoke the show() function:

bitnami@StockPredix:/opt/bitnami/apps/django/django_projects/Project$ python api-test_volume.py 
Traceback (most recent call last):
  File "api-test_volume.py", line 8, in <module>
    import matplotlib.pyplot as plt
  File "/opt/bitnami/python/lib/python2.7/site-packages/matplotlib/pyplot.py", line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/opt/bitnami/python/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/opt/bitnami/python/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>
    from matplotlib.externals.six.moves import tkinter as Tk
  File "/opt/bitnami/python/lib/python2.7/site-packages/matplotlib/externals/six.py", line 199, in load_module
    mod = mod._resolve()
  File "/opt/bitnami/python/lib/python2.7/site-packages/matplotlib/externals/six.py", line 113, in _resolve
    return _import_module(self.mod)
  File "/opt/bitnami/python/lib/python2.7/site-packages/matplotlib/externals/six.py", line 80, in _import_module
    __import__(name)
  File "/opt/bitnami/python/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter

This continued even after I installed other dependencies and tried installing tk-dev, tcl-dev, etc. I think I will need an alternative to matplotlib to produce the graphs, unless one of you kind souls knows a clever workaround. Thanks in advance for your help.

(Quick) Edit: I'm aware of and tried the fix in Save plot to image file instead of displaying it using Matplotlib, but on my cloud server this is a matter of broken dependency with the GUI in the first place, instead of just suppressing the GUI.

Copyright Notice:Content Author:「D. Silverstone」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40570033/matplotlib-equivalent-for-ubuntu-servers-with-no-gui

More about “matplotlib equivalent for Ubuntu servers with no GUI?” related questions

matplotlib equivalent for Ubuntu servers with no GUI?

I have a GUI-less cloud server running Bitnami-Django Ubuntu 14.04 LTS that is meant to retrieve and graph data for users, but it cannot produce the graphs. To be clear, I only care that the graph ...

Show Detail

matplotlib GUI tooltip

everytime i use matplotlib GUI on mac it leaves some text on screen. For example "Zoom Rectangle" tooltip appears on all windows ... and doesn't go away until I have closed python and matplotlib. ...

Show Detail

How To Get Remote Ubuntu GUI in local Virtualbox Ubuntu System?

The goal: a GUI interface to remote Ubuntu servers at Digital Ocean and AWS. Status: Running Ubuntu Desktop in Virtualbox in a Windows 10 host. Have ssh connection to the server with the ssh -X -C

Show Detail

installing matplotlib on ubuntu?

I have: Ubuntu 8.04 python 2.5.2 installed on this Ubuntu matplotlib 0.92.0 installed I want to upgrade to (atleast) matplotlib 0.99 so that I can do 3d plotting. The synaptic package (also the

Show Detail

Connecting to my Ubuntu AWS instance using a GUI interface

I need to transfer files from my local desktop system (running ubuntu 11) to my aws instance running Ubuntu 11. command line works just fine for me, however, I need a GUI solution. I have seen this

Show Detail

Easiest way to install a GUI backend for matplotlib?

I have been struggling to get plot using matplotlib.pyplot. Obviously, the problem is temp.py:58: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figu...

Show Detail

python opencv with docker: Matplotlib.show Matplotlib is currently using agg, which is a non-GUI backend

I need to run opencv + python in docker. This code should show a GUI popup with an image: import cv2 from matplotlib import pyplot as plt img = cv2.imread(&quot;image.jpg&quot;) img_gray = cv2.cvtC...

Show Detail

wxPython GUI: migrating gnuplot to matplotlib

I currently have a GUI built in wxPython with several sections, one of which displays a .png image of a plot: self.plot = wx.BitmapButton(self.pane_system, -1, wx.Bitmap("/home/myname/projects/new...

Show Detail

Ubuntu Server without GUI on an Azure XS virtual machine

I will be running ubuntu server without GUI with a small application written in c that communicates with other XS machines and my home computer over TCP, but i am confused about one thing my applic...

Show Detail

What is the default GUI backend for Matplotlib?

I have made the following script, let's call it test-matplotlib-printbackend.py: #!/usr/bin/env python import matplotlib as mpl import matplotlib.pyplot as plt xx = range(100) yy = [i*2+5 for i ...

Show Detail