Pages

Unixbhaskar's Blog

Tuesday, March 8, 2011

How to install python related stuff through setuptools of python

In this article I will guide you through a step which might benefit you to get a better grasp of python related stuff.As I was discovering a specific piece of software and come across few thing related to python(recollecting my old day association with ZOPE).So,basically this is called "easy_install", which will help you to install python files and packages to your system.

I am running Debian Sqeeze and not have that specific tool installed on it by default.So I went ahead and installed it first like below:


bhaskar@bhaskar-laptop_13:30:23_Tue Mar 08:~> sudo apt-get install python-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libgnomecupsui1.0-1c2a xfonts-scalable xfonts-75dpi libdmx1 xfonts-100dpi libgnomecups1.0-1
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  python-setuptools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 221 kB of archives.
After this operation, 1,057 kB of additional disk space will be used.
Get:1 http://ftp.us.debian.org/debian/ squeeze/main python-setuptools all 0.6.14-4 [221 kB]
Fetched 221 kB in 4s (51.7 kB/s)
Selecting previously deselected package python-setuptools.
(Reading database ... 165516 files and directories currently installed.)
Unpacking python-setuptools (from .../python-setuptools_0.6.14-4_all.deb) ...
Setting up python-setuptools (0.6.14-4) ...

So the package name is python-setuptools , once is installed it will install the "easy_install" thing in your system.Now I have some file to be inflated in my system which has .egg extension and which can read and understand by python installer.For that I have followed the below steps:



bhaskar@bhaskar-laptop_13:30:51_Tue Mar 08:~> sudo /usr/bin/easy_install cssutils-0.9.7-py2.4.egg
install_dir /usr/local/lib/python2.6/dist-packages/
Processing cssutils-0.9.7-py2.4.egg
creating /usr/local/lib/python2.6/dist-packages/cssutils-0.9.7-py2.4.egg
Extracting cssutils-0.9.7-py2.4.egg to /usr/local/lib/python2.6/dist-packages
Adding cssutils 0.9.7 to easy-install.pth file
Installing csscombine script to /usr/local/bin
Installing cssparse script to /usr/local/bin
Installing csscapture script to /usr/local/bin

Installed /usr/local/lib/python2.6/dist-packages/cssutils-0.9.7-py2.4.egg
Processing dependencies for cssutils==0.9.7
Searching for cssutils==0.9.7
Reading http://pypi.python.org/simple/cssutils/
Reading http://cthedot.de/cssutils/
Reading http://code.google.com/p/cssutils/downloads/list
Best match: cssutils 0.9.7
Downloading http://pypi.python.org/packages/2.6/c/cssutils/cssutils-0.9.7-py2.6.egg#md5=6fc9ef19579645a97d3f7c028f35d54c
Processing cssutils-0.9.7-py2.6.egg
creating /usr/local/lib/python2.6/dist-packages/cssutils-0.9.7-py2.6.egg
Extracting cssutils-0.9.7-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Removing cssutils 0.9.7 from easy-install.pth file
Adding cssutils 0.9.7 to easy-install.pth file
Installing csscombine script to /usr/local/bin
Installing cssparse script to /usr/local/bin
Installing csscapture script to /usr/local/bin

Installed /usr/local/lib/python2.6/dist-packages/cssutils-0.9.7-py2.6.egg
Finished processing dependencies for cssutils==0.9.7



Installing pyinotify

This is a module which helps to track file related activity on GNU/Linux system with the help of filesystems inotify modules.Here is how you can installed it:


bhaskar@bhaskar-laptop_14:52:08_Tue Mar 08:~/Downloads/wimleers-fileconveyor-207361c/code> sudo easy_install pyinotify
install_dir /usr/local/lib/python2.6/dist-packages/
Searching for pyinotify
Reading http://pypi.python.org/simple/pyinotify/
Reading http://github.com/seb-m/pyinotify
Best match: pyinotify 0.9.1
Downloading http://pypi.python.org/packages/source/p/pyinotify/pyinotify-0.9.1.tar.gz#md5=c22b12c31aeb19c387b2f1885b9b04b5
Processing pyinotify-0.9.1.tar.gz
Running pyinotify-0.9.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-H4WKcs/pyinotify-0.9.1/egg-dist-tmp-CK1S6N
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
zip_safe flag not set; analyzing archive contents...
Adding pyinotify 0.9.1 to easy-install.pth file

Installed /usr/local/lib/python2.6/dist-packages/pyinotify-0.9.1-py2.6.egg
Processing dependencies for pyinotify
Finished processing dependencies for pyinotify



So you can see in the above output that how easy_install works.Like the way gem work for ruby.

Hope this will help.

Cheers!
Bhaskar

No comments:

Post a Comment