source: doc/python_module.rst @ 56fa1e0

feature/autosinkfeature/cnnfeature/crepefix/ffmpeg5
Last change on this file since 56fa1e0 was 007c0a1, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[doc] move api references to doc, simplify pip instructions, add conda section

  • 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
[39d6fba]92A number of Python tests are provided in the `python tests`_. To run them,
93install `nose2`_ and run the script ``python/tests/run_all_tests``:
94
95.. code-block:: console
96
97    $ pip install nose2
98    $ ./python/tests/run_all_tests
[5417b3a]99
100.. _demo_filter.py: https://github.com/aubio/aubio/blob/master/python/demos/demo_filter.py
[d44763f]101.. _python tests: https://github.com/aubio/aubio/blob/master/python/tests
[39d6fba]102.. _nose2: https://github.com/nose-devs/nose2
Note: See TracBrowser for help on using the repository browser.