<commit_before>Installing borg
===============

Compilation and setup for borg involves four major steps, described in detail
in the other sections below:

#. installing any missing system-level dependencies;
#. installing the required Python dependencies;
#. installing borg and its required "cargo" library; and
#. calibrating borg to the local machine.

These instructions assume a bash shell on a Linux system.

Obtaining the project source code
---------------------------------

The suggested way to download the project source is to use `git
<http://git-scm.com/>`_, which will simplify acquiring future updates and
making local changes. Assuming that git is installed, clone the two
relevant repositories from `github <https://github.com/>`_:

.. code-block:: bash

    $ git clone git<EMAIL>.com:borg-project/cargo.git
    $ git clone git<EMAIL>:borg-project/borg.git

If git is not installed and cannot be installed, tarball snapshots of the
source trees can be downloaded from github's web interface; see the borg and
cargo repositories under the `borg project github page
<https://github.com/borg-project>`_.

Installing system dependencies
------------------------------

A reasonably complete development environment is required to compile borg and
its dependencies. That includes at least:

* Python >= 2.6
* compilers: gcc, gfortran, and g++
* devel packages for

  * Python
  * linear algebra libraries: BLAS, LAPACK, and/or ATLAS

Most, if not all, of these packages are common dependencies, and should already
be installed on a typical development machine.

Verifying Python >= 2.6
^^^^^^^^^^^^^^^^^^^^^^^

Make sure that you're using a recent Python version by running:

.. code-block:: bash

    $ python --version

and checking that it reports at least "Python 2.6".

Building Python on CentOS 5.4
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

CentOS 5.4, unfortunately, does not provide a modern version of Python. The
recommended solution is to install one into a user-owned local directory,
assumed to be ``~/local`` in the instructions that follow.

Download, unpack, build, and install Python 2.6:

.. code-block:: bash

    $ wget http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tar.bz2
    $ tar jxvf Python-2.6.6.tar.bz2
    $ cd Python-2.6.6
    $ ./configure --prefix=$HOME/local/
    $ make
    $ make install

Add ``~/local/bin`` to the beginning of your path:

.. code-block:: bash

    $ export PATH=~/local/bin:$PATH

Note that compiling a full Python system may require additional system
dependencies, e.g., development packages for ncurses and zlib.

Installing Python dependencies
------------------------------

The recommended approach to installing borg and its dependencies is to do so
inside a "virtualenv", a self-contained local Python environment. A copy of
the ``virtualenv`` tool is packaged with borg.<commit_msg>Link to the virtualenv documentation.<commit_after>Installing borg
===============

Compilation and setup for borg involves four major steps, described in detail
in the other sections below:

#. installing any missing system-level dependencies;
#. installing the required Python dependencies;
#. installing borg and its required "cargo" library; and
#. calibrating borg to the local machine.

These instructions assume a bash shell on a Linux system.

Obtaining the project source code
---------------------------------

The suggested way to download the project source is to use `git
<http://git-scm.com/>`_, which will simplify acquiring future updates and
making local changes. Assuming that git is installed, clone the two
relevant repositories from `github <https://github.com/>`_:

.. code-block:: bash

    $ git clone git@github.com:borg-project/cargo.git
    $ git clone git@github.com:borg-project/borg.git

If git is not installed and cannot be installed, tarball snapshots of the
source trees can be downloaded from github's web interface; see the borg and
cargo repositories under the `borg project github page
<https://github.com/borg-project>`_.

Installing system dependencies
------------------------------

A reasonably complete development environment is required to compile borg and
its dependencies. That includes at least:

* Python >= 2.6
* compilers: gcc, gfortran, and g++
* devel packages for

  * Python
  * linear algebra libraries: BLAS, LAPACK, and/or ATLAS

Most, if not all, of these packages are common dependencies, and should already
be installed on a typical development machine.

Verifying Python >= 2.6
^^^^^^^^^^^^^^^^^^^^^^^

Make sure that you're using a recent Python version by running:

.. code-block:: bash

    $ python --version

and checking that it reports at least "Python 2.6".

Building Python on CentOS 5.4
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

CentOS 5.4, unfortunately, does not provide a modern version of Python. The
recommended solution is to install one into a user-owned local directory,
assumed to be ``~/local`` in the instructions that follow.

Download, unpack, build, and install Python 2.6:

.. code-block:: bash

    $ wget http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tar.bz2
    $ tar jxvf Python-2.6.6.tar.bz2
    $ cd Python-2.6.6
    $ ./configure --prefix=$HOME/local/
    $ make
    $ make install

Add ``~/local/bin`` to the beginning of your path:

.. code-block:: bash

    $ export PATH=~/local/bin:$PATH

Note that compiling a full Python system may require additional system
dependencies, e.g., development packages for ncurses and zlib.

Installing Python dependencies
------------------------------

The recommended approach to installing borg and its dependencies is to do so
inside a "virtualenv", a self-contained local Python environment. A copy of
`the virtualenv tool <http://www.virtualenv.org/>`_ is packaged with borg.
{'fraction_non_alphanumeric': 0.13120444290177022, 'fraction_numerical': 0.009024644220756682, 'mean_word_length': 3.4709076803723815, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 16, 'https://': 4, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4771402', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1503, 'n_words': 696}