Installation#
All commands below use pip. For editable (development) installs from a local
clone, pass the -e flag (e.g. pip install -e .).
Tip
We recommend uv as a fast, modern package
manager. To use it, substitute uv pip for pip in all commands below.
PyPI#
Install the stable version of slmsuite from PyPI using:
pip install slmsuite
GitHub#
Install the latest version of slmsuite from GitHub using:
pip install git+https://github.com/holodyne/slmsuite
One can also clone slmsuite directly and add its directory to the Python path.
Remember to install the dependencies (next sections).
git clone https://github.com/holodyne/slmsuite
Required Dependencies#
The following python packages are necessary to run slmsuite. These are listed as PyPI
dependencies and thus are installed automatically if PyPI is used to install.
python >= 3.10
One can also install these dependencies directly by calling the following inside the package directory.
pip install -e .
Hardware Dependencies#
The following python packages are optional acceleration or hardware requirements, which the user can install selectively.
- GPU
pip install -e ".[gpu]" cupy, highly recommended for GPU-accelerated holography. Once installed, holograms and SLMs (unless
gpu=False) run oncupy; camera frames are returned in host memory unless a simulated camera is called withget_image(get=False). Withoutcupy,numpyis used as a backup. Thegpuextra installscupy-cuda13x(CUDA 13). For another CUDA version, skip the extra andpip install cupy-cudaYYx, findingYYwithnvcc --version.
- GPU
- Gradients
pip install -e ".[torch]" pytorch, required for gradient-based (
"CG") hologram optimization with atorch.optimoptimizer, either in GPU or CPU mode. Usescupy-torchinteroperability to pass data between modules without copying overhead, even on the GPU.
- Gradients
- Cameras
pip install -e ".[cameras]" mvsdk (non-PyPI)
PySpin (non-PyPI)
tisgrabber (non-PyPI)
thorlabs_tsi_sdk (non-PyPI)
VmbPy (non-PyPI)
Other cameras are loaded directly via .dll.
- Cameras
- Image saving
pip install -e ".[images]" For most images and videos, imageio
Many video formats additionally require pyav
For .gif optimization, pygifsicle
- Image saving
Jupyter#
We highly recommended using Jupyter
notebooks for interactive computing. Consider also using
IPython
magic,
features like %autoreload 2 or %matplotlib inline.
ipywidgets and ipyevents, for the
live()viewer of cameras and SLMsThe
imagesextra
Outside Jupyter, plt.show() blocks; call slmsuite.configure_plotting() with
mode="suppress" or mode="save" (and headless=True without a display).
Use the following to install recommended jupyter-related packages.
pip install -e ".[jupyter]"
All Dependencies#
To install the optional dependencies for GPU, gradients, SLMs, cameras, images, Jupyter,
docs, and testing at once, use the dev extra.
pip install -e ".[dev]"