Installation#

There are two ways to install the abTEM package, using conda or pip:

Install abTEM using conda:

conda install -c conda-forge abtem

(Instructions on how to install miniconda can be found here.)

Install abTEM using pip:

pip install abtem

Alternatively, if you have git and want to use unreleased features, you can install directly from github:

pip install git+https://github.com/abTEM/abTEM

Optional dependencies#

GPAW (not available on Windows)#

Some features of abTEM, such as calculating potentials from DFT, require a working installation of GPAW. See here for detailed installation instructions.

Install GPAW using conda:

conda install -c conda-forge gpaw

Install GPAW using pip:

pip install gpaw

Install the PAW datasets into the folder <dir> using this command:

gpaw install-data <dir>

GPU (only NVIDIA)#

GPU calculations with abTEM require a working installation of CuPy and compatible hardware. See here for detailed installation instructions.

Install CuPy using conda:

conda install -c conda-forge cupy

First, install the CUDA Toolkit.

Install CuPy using pip:

pip install cupy-cuda*

where * should be substituted for the CUDA Toolkit version.

Metal on Apple silicon (experimental)#

A subset of features in abTEM can be accelerated on Apple silicon processors using their Metal API. To enable this features requires a working installation of PyTorch. Metal support is currently highly experimental, and not all features are supported. Features not currently supported, will fall back to the NumPy implementation.

conda install pytorch torchvision torchaudio -c pytorch-nightly
conda install -c conda-forge abtem jupyterlab
pip install scipy --force-reinstall --no-deps

To enable this feature you need to configure enable_mps.

import abtem
abtem.config.set(enable_mps=True)

You can verify that mps support is available using the code below:

import torch
assert torch.backends.mps.is_available()

wave = abtem.PlaneWave(energy=100e3, gpts=128, sampling=0.05)
assert wave.build(lazy=False).copy_to_device("mps").array.device.type == "mps"

Development installation#

See our guide to contributing for instructions on a development installation of abTEM.