============
Installation
============
kikuchipy can be installed with `pip `__,
`conda `__, the
:ref:`hyperspy:hyperspy-bundle`, or from source, and supports Python >= 3.10.
All alternatives are available on Windows, macOS and Linux.
.. _install-with-pip:
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
To install *with* optional dependencies::
pip install "kikuchipy[all]"
.. _install-with-anaconda:
With Anaconda
=============
To install with Anaconda, we recommend you install it in a
:doc:`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
To install *without* optional dependencies::
conda install kikuchipy-base
.. _install-with-hyperspy-bundle:
With the HyperSpy Bundle
========================
kikuchipy is available in the HyperSpy Bundle. See :ref:`hyperspy:hyperspy-bundle` for
instructions.
.. _install-from-source:
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 :ref:`setting-up-a-development-installation` and keeping
it up to date.
.. _dependencies:
Dependencies
============
kikuchipy builds on the great work and effort of many people.
This is a list of core package dependencies:
* :doc:`dask `: Out-of-memory processing of data larger than RAM.
* :doc:`diffpy.structure `: Handling of crystal structures.
* :doc:`diffsims `: Handling of reciprocal lattice vectors and structure
factors.
* :doc:`hyperspy `: Multi-dimensional data handling (EBSD class etc.).
* :doc:`h5py `: Read/write of HDF5 files.
* :doc:`imageio `: Read image formats.
* `lazy_loader`_: Lazy loading of functions, classes, and modules.
* :doc:`matplotlib `: Visualization.
* :doc:`numba `: CPU acceleration via just-in-time compilation.
* :doc:`numpy `: Handling of N-dimensional arrays.
* :doc:`packaging `: Version comparison.
* :doc:`orix `: Handling of rotations and vectors using crystal symmetry.
* `pyyaml `__: Parsing of YAML files.
* :doc:`scikit-image `: Image processing like adaptive histogram
equalization.
* :doc:`rosettasciio `: Read/write of some file formats.
* `scikit-learn `__: Multivariate analysis.
* :doc:`scipy `: Optimization algorithms, filtering and more.
* `tqdm `__: Progressbars.
* :doc:`typing-extensions `: Type hints only available from
Python >= 3.11.
.. _lazy_loader: https://scientific-python.org/specs/spec-0001/#lazy_loader
Some functionality requires optional dependencies:
* `ebsdsim `__: Dynamical EBSD simulations and
reading of simulations produced by `ebsdsim`.
Currently unavailable from conda-forge.
* :doc:`ipywidgets `: Interactive widgets in Jupyter notebooks.
* `IPython `__: Interactive widgets in Jupyter
notebooks.
* `nlopt `__: Extra
optimization algorithms used in EBSD orientation and/or projection center refinement.
Installation from conda ``conda install nlopt -c conda-forge`` is recommended.
* :doc:`pooch `: Downloading and caching of datasets.
* `psygnal `__: Trigger actions based on state changes.
* :doc:`pyebsdindex `: Hough indexing.
We recommend to install with optional GPU support via :doc:`pyopencl`
with ``pip install "pyebsdindex[gpu]"`` or
``conda install pyebsdindex -c conda-forge``.
* :doc:`pyvista `: 3D plotting of master patterns.
Note that installing with the optional dependencies, ``pip install "kikuchipy[all]"``,
will not install ``pyopencl``, which is required for GPU support in ``pyebsdindex``.
If the install command failed for some reason, you can try to install each optional
dependency separately.