0

I am reading a Python book and one of the examples shows this cool way to dynamically render data from a file using a Python module called gdchart. I tried to install this with pip and easy_install on an Ubuntu machine and an OS-X machine and it failed every time!

I did a few searches using Google and did not come up with anything really. I saw something that looks similar on the PyPi site here: https://pypi.python.org/pypi/fullChart/0.1.a

This web-page from Ubuntu also looks like it may have some useful information: http://packages.ubuntu.com/lucid/python-gd

However, when I run the command sudo apt-get install python-gd I receive an error saying that this cannot be installed because of one reason or another. Here is the exact error message:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package python-gdchart is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python-gdchart' has no installation candidate

Does anyone know how to install this module, gdchart?

Here is the source-code I am trying to run that uses it:

#! /usr/bin/env python

import gdchart
import shelve

shelve_file = shelve.open('access.s')
items_list = [(i[1], i[0]) for i in shelve_file.items()]
items_list.sort()
bytes_sent = [i[0] for i in items_list]
#ip address = [i[1] for i in items_list]
ip_addresses = ['XXX.XXX.XXX.XXX' for i in items_list]

chart = gdchart.Bar()
chart.width = 400
chart.height = 400
chart.bg_color = 'white'
chart.plot_color = 'black'
chart.xtitle = "IP Address"
chart.ytitle = "Bytes Sent"
chart.title = "Usage by IP Address"
chart.setData(bytes_sent)
chart.setLabels(ip_addresses)
chart.draw("bytes_ip_bar.png")

shelve_file.close()
user_loser
  • 881
  • 1
  • 13
  • 27

1 Answers1

0

did you mean pygdchart?

It is available on Pypi: https://pypi.python.org/pypi/pygdchart

dnozay
  • 23,846
  • 6
  • 82
  • 104
  • Hi, thank-you for the reply. :D I typed *sudo pip install pygdchart* and received this heinous error message `_gdchartc.c:35:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1` :/ – user_loser Nov 07 '14 at 04:14
  • http://stackoverflow.com/questions/15631135/python-h-missing-from-ubuntu-12-04 I tried following this advice for the missing Python.h but it did not work when running `sudo apt-get update` and then `sudo apt-get install python-dev` :/ – user_loser Nov 07 '14 at 04:25
  • `sudo apt-file search Python.h` will give you the name of the development package – dnozay Nov 07 '14 at 06:24
  • I tried this command but just received an error saying: `sudo: apt-file: command not found` – user_loser Nov 09 '14 at 02:19
  • UPDATE - I just read this page: https://wiki.ubuntu.com/AptFile and am installing apt-file now. :D Thank-you for this Ubuntu tip! I was wondering about Python but learned something new about Ubuntu. :D – user_loser Nov 09 '14 at 02:27
  • I had to use the `sudo apt-file search gdchart.h` command again to find one more missing c header file for my Ubuntu machine and now I am able to install `pygdchart` and `import gdchart` in a python interactive shell! Thank-you very much dnozay. You rock sir. May a buxom nubile beauty greet you with many presents. – user_loser Nov 09 '14 at 02:36