I am trying to find a way to include a library in a Ubuntu/Python/PyGtk application even though It is not included in the stock python enviornment and I can't add it as a dependency in my setup.py file. The library is called pygal and does have a PIP package (No available .deb or ppa) but I was looking for a way to include it in my application. I would think I could just include the source .py files to the library but I am unsure of how to go about including it in my code. Pygal also requires the lxml python library. I can install it via pip on my machine and it works fine but didn't know if there was anyway to automate or include this in my .deb package's setup.py file. Any help or advice would be greatly appreciated.
Asked
Active
Viewed 2,377 times
1
-
why can't you add it to setup.py e.g., `install_requires=['pygal'],`? setup.py describes a Python package, not `.deb`. – jfs Dec 13 '12 at 13:03
-
You would be contributing to the overall health of the linux community if you took the initiative to *get pygal packaged* http://www.debian.org/devel/join/ – SingleNegationElimination Dec 13 '12 at 13:53
2 Answers
0
I think this should work though I'm not sure.
You put the folder with the name pygal
from the pygal egg in your application directory. You can take it from your python installation - it should have this path:
/usr/local/lib/python2.7/dist-packages/pygal-0.13.0-py2.7.egg/pygal
or if you use python 3.1
/usr/local/lib/python3.1/dist-packages/pygal-0.13.0-py3.1.egg/pygal
or download it from pipy
.
You can use it like any python library:
from pygal import *

doru
- 9,022
- 2
- 33
- 43
-
Ok, this sort of works but I still need to get the lxml library for it to import pygal correctly. Do I need to do the same thing and then change all the pygal files? Thanks for all the help! – zzzzzzzzzz654 Dec 13 '12 at 20:46
-
Yes, I think you should do the same with the `lxml` library. You don't need to change the pygal files as long as the `pygal` folder and the `lxml` folder are in the same directory (the application directory). – doru Dec 13 '12 at 20:53
-
Never mind, I am an idiot, it comes preinstalled with Ubuntu. Its installed as the python-lxml package from apt. Thank you so much for everything – zzzzzzzzzz654 Dec 13 '12 at 20:57
0
I've actually figured out how to package this as a *deb file that I can include in my future PPA (or possibly submit to the community) that will (hopefully) cleanly install the python package on the system. I found a great write up in the Debian wiki that actually doesn't seem cryptic to a newbie like myself, oddly enough. http://wiki.debian.org/Python/Packaging#Example_1:_Python_extension

zzzzzzzzzz654
- 13
- 3