Installation#

kikuchipy can be installed with pip, conda, the HyperSpy Bundle, or from source, and supports Python >= 3.10. All alternatives are available on Windows, macOS and Linux.

With pip#

kikuchipy is availabe from the Python Package Index (PyPI), and can therefore be installed with pip. To install, run the following:

pip install kikuchipy

To update kikuchipy to the latest release:

pip install --upgrade kikuchipy

To install a specific version of kikuchipy (say version 0.8.5):

pip install kikuchipy==0.8.5

With Anaconda#

To install with Anaconda, we recommend you install it in a conda environment with the Miniconda distribution. To create an environment and activate it, run the following:

conda create --name kp-env python=3.12
conda activate kp-env

If you prefer a graphical interface to manage packages and environments, you can install the Anaconda distribution instead.

To install:

conda install kikuchipy --channel conda-forge

To update kikuchipy to the latest release:

conda update kikuchipy

To install a specific version of kikuchipy (say version 0.8.5):

conda install kikuchipy==0.8.5

With the HyperSpy Bundle#

kikuchipy is available in the HyperSpy Bundle. See HyperSpy Bundle for instructions.

Warning

kikuchipy is updated more frequently than the HyperSpy Bundle, thus the installed version of kikuchipy will most likely not be the latest version available. See the HyperSpy Bundle repository for how to update packages in the bundle.

From source#

To install kikuchipy from source, clone the repository from GitHub, and install with pip:

git clone https://github.com/pyxem/kikuchipy.git
cd kikuchipy
pip install --editable .

See the contributing guide for Setting up a development installation and keeping it up to date.

Dependencies#

kikuchipy builds on the great work and effort of many people. This is a list of core package dependencies:

  • dask: Out-of-memory processing of data larger than RAM

  • diffpy.structure: Handling of crystal structures

  • diffsims: Handling of reciprocal lattice vectors and structure factors

  • hyperspy: Multi-dimensional data handling (EBSD class etc.)

  • h5py: Read/write of HDF5 files

  • imageio: Read image formats

  • lazy_loader: Lazy loading of functions, classes, and modules

  • matplotlib: Visualization

  • numba: CPU acceleration via just-in-time compilation

  • numpy: Handling of N-dimensional arrays

  • orix: Handling of rotations and vectors using crystal symmetry

  • pooch: Downloading and caching of datasets

  • pyyaml: Parcing of YAML files

  • tqdm: Progressbars

  • scikit-image: Image processing like adaptive histogram equalization

  • scikit-learn: Multivariate analysis

  • scipy: Optimization algorithms, filtering and more

Some functionality requires optional dependencies:

  • pyebsdindex: Hough indexing. We recommend to install with optional GPU support via pyopencl with pip install "pyebsdindex[gpu]"" or conda install pyebsdindex -c conda-forge.

  • nlopt: Extra optimization algorithms used in EBSD orientation and/or projection center refinement. Installation from conda conda install nlopt -c conda-forge is recommended.

  • pyvista: 3D plotting of master patterns.

Install all optional dependencies:

pip install "kikuchipy[all]"

Note that this command will not install pyopencl, which is required for GPU support in pyebsdindex. If the above command failed for some reason, you can try to install each optional dependency individually.