# Installation

Installing Enaml is a straight-forward process. There are three approaches to choose from.

## Anaconda

If you use the Anaconda Python distribution platform (or Miniconda, its lighter-weight companion), the latest release of Enaml can be installed using conda from the conda-forge channel:

    $ conda install enaml -c conda-forge

## Wheels

If you don’t use Anaconda, you can install Enaml and its dependencies, pre-compiled, through PIP, for most common platforms.

You will need three things:

- Python

- Enaml (and its dependencies)

- a toolkit rendering library

### Python

Enaml is a Python framework and requires a supported Python runtime. Enaml currently supports Python 3.8, Python 3.9 and Python 3.10.

Note

Currently Enaml does support the match syntax introduced in Python 3.10 in .enaml files

The most recent Python releases are available on the Python Downloads pages. Installers are available for Windows and OSX. Linux users should install Python using their OS package manager.

### Enaml and Dependencies

You can install enaml and (almost) all of its dependencies through the pip command line.:

    $ pip install enaml

### Toolkit Rendering Library

Enaml’s declarative widgets provide a layer of abstraction on top of the widgets of a toolkit rendering library. Enaml ships with a backend based on Qt5/6 and third-party projects such as enaml-web and enaml-native provides alternative backends.

Enaml uses the QtPy library as compatibility layer to support transparently both Qt 5 and Qt 6 through either PyQt or PySide. PyQt5 has been supported for a longer time and has been more heavily tested.

Starting with Enaml 0.13.0, you can specify a rendering library using extra_requires, ie:

    $ pip install enaml[qt5-pyqt]

    Currently, you can use either [qt5-pyqt] to use PyQt5, [qt5-pyside] to
    use Pyside2, or [qt6-pyqt] and [qt6-pyside] if you want to use Qt6.

Starting with Enaml 0.15.1, you can also specify additional extras needed for specific widgets:

- Scintila widget: [scintilla-qt5-pyqt] or [scintilla-qt6-pyqt]

- Matplotlib canvas: [matplotlib-qt]

- IPython console: [ipython-qt]

- WebView (extra are needed only for PyQt): [webview-qt5-pyqt] or [webview-qt6-pyqt]

- VTK canvas: [vtk-qt]

Note

One can specify multiple extras separated by `,`::

  $ pip install enaml[qt5-pyqt,ipython-qt]

Note

There is no pyqt5 wheel available for 32-bit Linux.

## Compiling it yourself: The Hard Way

Building Enaml from scratch requires a few external dependencies. The sections below describe how to install Enaml and all of its dependencies from scratch. The instructions assume that the user’s system has a C++ compiler and the Git command line tools installed and available on the system path.

### Pip

Pip is the default package manager for Python. The installation instructions below assume that Pip has been installed in the target Python environment (see Pip install).

### Ply

The Enaml framework extends the grammar Python language with new declarative syntax constructs. To accomplish this, Enaml has a fully compliant Python 3.7/3.8/3.9 lexer and parser with added support for the new syntax. These components are built using the PLY parsing tools, which contain Python implementations of lex and yacc.

Ply can be installed with the `pip install` command of Pip:

    $ pip install ply

### QtPy

The Enaml framework uses the QtPy library as a compatibility shim between the various toolkit rendering libraries.

QtPy can be installed with the `pip install` command of Pip:

    $ pip install QtPy

And you also need a toolkit rendering library either PyQt5, PyQt6, Pyside2, or PySide6 which all be installed through pip.

### Kiwisolver

Enaml’s layout engine is built on top of the Cassowary linear constraint optimizer. This is the same algorithm used by the Cocoa Autolayout engine in OSX. Kiwisolver provides Python bindings to a C++ implementation of the Cassowary algorithm.

Kiwisolver can be installed with the `pip install` command of Pip:

    $ pip install kiwisolver

### Bytecode

The Enaml compiler depends on the `bytecode` module, which is a Python library used to generate and modify bytecode.

Bytecode can be installed with the `pip install` command of Pip:

    $ pip install bytecode

### Atom

Atom is the Python framework which provides the foundational object model for Enaml. Atom objects are extremely lightweight, fast, and support a robust implementation of the Observer Pattern. If these traits seem all too ideal for a project like Enaml, it’s because Enaml was the primary motivation behind the development of Atom.

Atom can be installed with the `pip install` command of Pip:

    $ pip install atom

Alternatively, cloning and building the latest (unstable dev) version of Atom from source is simple:

    $ git clone https://github.com/nucleic/atom.git
    $ cd atom
    $ pip install .

### Enaml

The last item on the list is Enaml itself. The latest (unstable dev) version can be installed with just a few commands:

    $ git clone https://github.com/nucleic/enaml.git
    $ cd enaml
    $ pip install .

## Supported Platforms

Enaml is known to run on Windows, OSX, and Linux; and compiles cleanly with MSVC, Clang, GCC, and MinGW. However, primary development of the framework occurs on Windows (7, 8 and 10), so some quirks and bugs may be present on the other platforms. If you encounter a bug, please report it on the Issue Tracker.