Skip to content
Snippets Groups Projects
Select Git revision
  • b43cd07ec70dad553bf41ed626d871b02def53a4
  • master default protected
  • tut_ring_allen
  • docs_furo
  • docs_reorder_cable_cell
  • docs_graphviz
  • docs_rtd_dev
  • ebrains_mirror
  • doc_recat
  • docs_spike_source
  • docs_sim_sample_clar
  • docs_pip_warn
  • github_template_updates
  • docs_fix_link
  • cv_default_and_doc_clarification
  • docs_add_numpy_req
  • readme_zenodo_05
  • install_python_fix
  • install_require_numpy
  • typofix_propetries
  • docs_recipe_lookup
  • v0.10.0
  • v0.10.1
  • v0.10.0-rc5
  • v0.10.0-rc4
  • v0.10.0-rc3
  • v0.10.0-rc2
  • v0.10.0-rc
  • v0.9.0
  • v0.9.0-rc
  • v0.8.1
  • v0.8
  • v0.8-rc
  • v0.7
  • v0.6
  • v0.5.2
  • v0.5.1
  • v0.5
  • v0.4
  • v0.3
  • v0.2.2
41 results

python.rst

Blame
  • Ben Cumming's avatar
    Benjamin Cumming authored and GitHub committed
    Improve the Python wrapper generation and installation:
      - install a proper module that can be extended with Python code;
      - give the user more control over where to install the module (e.g. as a user package or in a virtualenv).
    
    During building, the following sub-directory is built in the build director (`CMAKE_BINARY_DIR`)
    ```
    └── python
        └── arbor
                ├── __init__.py
                ├── arbor.so
                └── VERSION
    ```
    This path can then be copied VERBATIM to the target installation path. By default this will be in `CMAKE_INSTALL_PREFIX/lib/python%d.%d/site-packages`.
    An additional CMake parameter `ARB_PYTHON_PREFIX` can be used to specify an alternative destination for installing the Python module.
    
    The Python part of the wrapper, implemented in `__init__.py` is currently very limited, only providing `__version__` and `__config__` variables.
    
    The installation guide was updated to cover the Python installation.
    b43cd07e
    History
    python.rst 1.75 KiB

    Python

    Arbor provides access to all of the C++ library's functionality in Python, which is the only interface for many users. The getting started guides will introduce Arbor via the Python interface.

    To test that Arbor is available, try the following in a Python 3 interpreter:

    >>> import arbor
    >>> print(arbor.__config__)
    {'mpi': True, 'mpi4py': True, 'gpu': False, 'version': '0.2.3-dev'}
    >>> print(arbor.__version__)
    0.2.3-dev

    The dictionary arbor.__config__ contains information about the Arbor installation. This can be used to check that Arbor supports features that you require to run your model, or even to dynamically decide how to run a model. Single cell models like do not require parallelism like that provided by MPI or GPUs, so the 'mpi' and 'gpu' fields can be False.

    Installing

    Before starting Arbor needs to be installed with the Python interface enabled, following the :ref:`Python configuration <pythonfrontend>` in the :ref:`installation guide <installarbor>`.

    Performance

    The Python interface can incur significant performance overheads relative to C++ during the model building phase, however simulation performance is be the same for both interfaces.

    Python 2

    Python 2 reached end of life in January 2020. Arbor only officially supports Python 3.6 and later, and all examples in the documentation are in Python 3. While it is possible to install and run Arbor using Python 2.7 by setting the PYTHON_EXECUTABLE variable when configuring CMake, support is only provided for using Arbor with Python 3.6 and later.