source: doc/python_module.rst @ b8e23f8

Last change on this file since b8e23f8 was e893e6fe, checked in by Paul Brossier <piem@piem.org>, 6 years ago

Merge branch 'master' into feature/pytest

  • Property mode set to 100644
File size: 2.8 KB
RevLine 
[68daf5b]1.. _python-install:
[d44763f]2
[68daf5b]3Installing aubio for Python
4===========================
[34abeaf]5
[007c0a1]6aubio is available as a package for Python 2.7 and Python 3. The aubio
7extension is written C using the `Python/C`_ and the `Numpy/C`_ APIs.
8
9.. _Python/C: https://docs.python.org/c-api/index.html
10.. _Numpy/C: https://docs.scipy.org/doc/numpy/reference/c-api.html
11
12For general documentation on how to install Python packages, see `Installing
13Packages`_.
[d44763f]14
[5417b3a]15Installing aubio with pip
16-------------------------
[241e2fb]17
[007c0a1]18aubio can be installed from `PyPI`_ using ``pip``:
[d44763f]19
[3d8a6c0]20.. code-block:: console
[241e2fb]21
22    $ pip install aubio
23
[007c0a1]24See also `Installing from PyPI`_ for general documentation.
25
26.. note::
27
28  aubio is currently a `source only`_ package, so you will need a compiler to
29  install it from `PyPI`_. See also `Installing aubio with conda`_ for
30  pre-compiled binaries.
31
32.. _PyPI: https://pypi.python.org/pypi/aubio
33.. _Installing Packages: https://packaging.python.org/tutorials/installing-packages/
34.. _Installing from PyPI: https://packaging.python.org/tutorials/installing-packages/#installing-from-pypi
35.. _source only: https://packaging.python.org/tutorials/installing-packages/#source-distributions-vs-wheels
36
37Installing aubio with conda
38---------------------------
[34abeaf]39
[007c0a1]40`Conda packages`_ are available through the `conda-forge`_ channel for Linux,
41macOS, and Windows:
[34abeaf]42
[3d8a6c0]43.. code-block:: console
[34abeaf]44
[007c0a1]45    $ conda config --add channels conda-forge
46    $ conda install -c conda-forge aubio
[34abeaf]47
[007c0a1]48.. _Conda packages: https://anaconda.org/conda-forge/aubio
49.. _conda-forge: https://conda-forge.org/
[6d4802f]50
51.. _py-doubleprecision:
52
53Double precision
54----------------
55
56This module can be compiled in double-precision mode, in which case the
57default type for floating-point samples will be 64-bit. The default is
58single precision mode (32-bit, recommended).
59
60To build the aubio module with double precision, use the option
61`--enable-double` of the `build_ext` subcommand:
62
63.. code:: bash
64
65    $ ./setup.py clean
66    $ ./setup.py build_ext --enable-double
67    $ pip install -v .
68
69**Note**: If linking against `libaubio`, make sure the library was also
70compiled in :ref:`doubleprecision` mode.
71
72
[f8bf0c2]73Checking your installation
74--------------------------
[5417b3a]75
[109ba42]76Once the python module is installed, its version can be checked with:
77
78.. code-block:: console
79
80    $ python -c "import aubio; print(aubio.version, aubio.float_type)"
81
82The command line `aubio` is also installed:
83
84.. code-block:: console
85
86    $ aubio -h
[34abeaf]87
[5417b3a]88
89Python tests
90------------
91
[e893e6fe]92A number of Python tests are provided in the `python/tests`_ folder. To run
93them, install `pytest`_ and run it from the aubio source directory:
[39d6fba]94
95.. code-block:: console
[a9e3bd0]96
[e893e6fe]97    $ pip install pytest
98    $ git clone https://git.aubio.org/aubio/aubio
[a9e3bd0]99    $ cd aubio
100    $ pytest
101
[e893e6fe]102.. _python/tests: https://github.com/aubio/aubio/blob/master/python/tests
103.. _pytest: https://pytest.org
Note: See TracBrowser for help on using the repository browser.