.. _installation: Installation ============ PyPI ---- Install the stable version of |slmsuite|_ from `PyPI `_ using: .. code-block:: console pip install slmsuite GitHub ------ Install the latest version of |slmsuite|_ from `GitHub `_ using: .. code-block:: console pip install git+https://github.com/slmsuite/slmsuite One can also clone |slmsuite|_ directly and add its directory to the Python path. *Remember to install the dependencies (next sections)*. .. code-block:: console git clone https://github.com/slmsuite/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 (``pip``) is used to install. - `python `_ - `numpy `_ - `scipy `_ - `opencv-python `_ - `matplotlib `_ - `h5py `_ - `tqdm `_ One can also install these dependencies directly. .. code-block:: console pip install -r requirements.txt Hardware Dependencies --------------------- The following python packages are *optional* acceleration or hardware requirements, which the user can install selectively. - GPU - `cupy `_, highly recommended for GPU-accelerated holography. Sometimes, installation is made complicated by a pre-installed version of CUDA. You can find the CUDA version with ``nvcc --version`` in a terminal, and then install an installation of :mod:`cupy` specific to CUDA version ``YY`` with ``pip install cupy-cudaYYx``. - Gradients - `pytorch `_, required for conjugate gradient hologram optimization, either in GPU or CPU mode. Uses :mod:`cupy` - :mod:`torch` `interoperability `_ to pass data between modules without copying overhead, even on the GPU. - Cameras - `instrumental-lib `_ - `pylablib `_ - `pymmcore `_ - `pypylon `_ - `mvsdk `_ (non-PyPI) - `PySpin `_ (non-PyPI) - `tisgrabber `_ (non-PyPI) - `thorlabs_tsi_sdk `_ (non-PyPI) - `VmbPy `_ (non-PyPI) - Other cameras are loaded directly via .dll. - SLMs - `pyglet `_ - Other SLMs are loaded directly via .dll. - Image saving - For most images and videos, `imageio `_ - Many video formats additionally require `pyav `_ - For .gif optimization, `pygifsicle `_ Jupyter ------- We highly recommended using `Jupyter `_ notebooks for interactive computing. Consider also using `IPython `_ `magic `_, features like |autoreload|_ or |matplotlibs|_. - `jupyter `_ If Jupyter is not used, the default :mod:`matplotlib` plots will block further execution, so the user should avoid plotting with ``plot=False`` flags on functions. Use the following to install recommended jupyter-related packages. .. code-block:: console pip install -r requirements_ipython.txt .. |slmsuite| replace:: :mod:`slmsuite` .. _slmsuite: https://github.com/slmsuite/slmsuite .. |autoreload| replace:: ``%autoreload 2`` .. _autoreload: https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html .. |matplotlibs| replace:: ``%matplotlib inline`` .. _matplotlibs: https://ipython.readthedocs.io/en/stable/interactive/plotting.html