Downloading and installing
==========================

Prerequisites
-------------

* Python 2.6 or later (available from http://www.python.org/getit/)


.. _pip_installation:

Installing using pip
--------------------

The simplest and recommended method of installation is using `pip <http://www.pip-installer.org>`_.


To download and install, type [#f1]_ on a console window::

    pip install https://sites.google.com/site/libutilitaspy/downloads/libutilitaspy-|version|.tar.gz


.. note::
   If you don't have pip, then follow the instructions from this link: http://www.pip-installer.org/en/latest/installing.html

  

Installing using only distutils
-------------------------------

Type [#f1]_ [#f2]_ on a console window:: 

    cd /path/to/your/downloads/folder
    wget https://sites.google.com/site/libutilitaspy/downloads/libutilitaspy-0.1dev.tar.gz
    tar zxf libutilitaspy-0.1dev.tar.gz
    cd libutilitaspy-0.1dev
    python setup.py install

.. note:: 
   It is preferable to install using pip, as it makes it easier to uninstall packages.


Uninstalling using pip
----------------------

Type [#f1]_ on a console window:: 

    pip uninstall libutilitaspy


Uninstalling using only distutils
---------------------------------

1. Find out the Python prefix directory. You can do that by typing on the command line::

    $ python -c "import sys; print sys.prefix"
    
   For a standard central Python distribution, this is typically ``/usr`` or ``/usr/local`` on Linux [#f3]_ or ``C:\Python26`` on Windows, but it could be something else, for example if you are using ``virtualenv``.

2. Find out the location of the Python ``site-packages`` directory. On Linux this is ``<prefix>/lib/python<version>/site-packages`` [#f4]_ and ``<prefix>\lib\site-packages`` on Windows. 

   So for example, common locations are ``/usr/lib/python2.6/site-packages`` and ``/usr/local/lib/python2.6/dist-packages``.

3. Go to the ``site-packages`` folder and remove the package and egg info, e.g.::

   $ cd /usr/lib/python2.6/site-packages
   $ rm -rf libutilitaspy*

4. On Linux, go to the ``<prefix>/share`` directory and remove the package folder. For example::

   $ cd /usr/share
   $ rm -rf libutilitaspy*
   

.. rubric:: Footnotes

.. [#f1] You may need to type ``sudo`` in front of the ``pip install ...`` command (or ``python setup.py install``)
.. [#f2] The ``wget`` command is a command on Unix-like systems (Linux, MacOSX) which downloads the distribution archive, and may not be available on all platforms. Alternatively you can just download and extract the archive in a folder of your choice. An alternative to ``wget`` is the ``curl`` command.
.. [#f3] Some distributions have Python on both ``/usr`` and ``/usr/local`` so you might have to check both.
.. [#f4] On Debian-based distributions such as Ubuntu, ``site-packages`` is usually called ``dist-packages``.

