Installation
Current Release |
1.1.4 |
Documentation Build Date |
07/14/2026, 19:16:53 |
Author(s) |
The SpinLab Team |
The source code is maintained on GitHub: SpinLab on GitHub
To check the SpinLab version currently installed on your computer:
$ pip show spinlab
SpinLab can be easily installed via pip:
$ pip install spinlab
Requirements
SpinLab requires Python 3.10 or higher.
SpinLab uses a few well-known Python packages, which will be automatically installed during the installation. Currently, the following packages and their respective minimal versions are required:
Package |
Version |
NumPy |
2.0.0 or higher |
SciPy |
1.14.0 or higher |
Matplotlib |
3.9.0 or higher |
h5py |
3.11.0 or higher |
Ways to Install SpinLab
Installing Using Pip
The easiest and most convenient way to install SpinLab is by using pip. In a terminal simply type the following command:
$ python -m pip install spinlab
or just:
$ pip install spinlab
If you prefer to install SpinLab from the source code, check out our GitHub repository SpinLab on GitHub. The newest developments are always merged into the Development branch.
Confirm Successful Installation
To confirm a successful SpinLab installation execute the following command in a terminal window:
$ pip show spinlab
The output will look similar to this (note, the actual version and path to location depends on your local installation):
Name: spinlab
Version: 1.0.0
Summary: SpinLab - Bringing the Power of Python to MR Spectroscopy
Home-page:
Author:
Author-email:
License-Expression: MIT
Location: Path/to/Package
Editable project location: Path/to/editable/location
Requires:
Required-by:
Specify a SpinLab Version to Install
If you wish to install a specific SpinLab version execute the following command in a terminal window:
$ pip install spinlab==1.0.0
Install Preliminary Release
If you wish to use a pre-release version of SpinLab (downloaded from the GitHub repository) we recommend first uninstalling the current SpinLab version. Clone (or download or fork ...) the desired branch from the GitHub repository. In a terminal window navigate into the directory that contains the spinlab folder (important, DO NOT navigate into the folder) and execute the following command:
$ pip install -e spinlab
Once the installation is finished verify the path and version of the package by executing the following command in a terminal window:
$ pip show spinlab
If the version does not match the version of the checked-out branch, you may have to first uninstall SpinLab (pip uninstall spinlab), then re-install the version you would like to use (pip install spinlab), and then run (pip install -e spinlab) if you would like to make your own changes to the code.
Upgrading SpinLab
To upgrade the currently installed version of SpinLab execute the following command in a terminal window:
$ pip install --upgrade spinlab
Uninstalling SpinLab
Don't like SpinLab? Please let us know how to improve the package.
The safest method to uninstall SpinLab is to use pip by executing the following command in a terminal window:
$ pip uninstall spinlab
Installing SpinLab Using a Virtual Environment (Ubuntu)
Starting from Ubuntu 23.10 pip3 will issue a warning when trying to install SpinLab from PyPi. It is recommended to not perform a global install but instead use a virtual environment (venv). If you do not have already created a virtual environment you can create a folder at a convenient location where the environment will be located (see example below).
In this example this will be in our home folder and the folder will be named SpinLab. To create this environment use the command
$ python3 -m venv ~/SpinLab
Note that you need to activate the environment to use it and install packages via pip3. You can activate the virtual environment by sourcing the activate script that should be located in ~/SpinLab/bin
$ source ~/SpinLab/bin/activate
This needs to be done every time you start this particular environment. To simplify this process, you can create an alias "spinlab" and add it to your .bash_aliases file
$ echo "spinlab = 'source ~/SpinLab/bin/activate'" >> ~/.bash_aliases
To deactivate the virtual environment enter the following command in a terminal.
$ deactivate