Installation

Setting up Python

It is best to first create a new Python environment for NUPyLab so it doesn’t interfere with the system Python installation or other environments. The easiest way to create and manage a Python environment for NUPyLab is with conda. Miniconda provides a light-weight alternative to the heavier (but fancier) Anaconda, which may be better for older lab computers. Conda environments can also manage non-Python dependencies, which is helpful for installing NUPyLab.

Download and install the appropriate Python version of Anaconda or Miniconda for your operating system. The latest version of Python that can run on Windows 7 is Python 3.8.

Installing NUPyLab

If you have Anaconda or Miniconda, you can use conda to create a new Python environment. NUPyLab requires either PyQt or PySide, and it is recommended that either be installed with conda first before installing NUPyLab with pip. NUPyLab uses Qt graphics, and installing PyQt or PySide with conda will make sure Qt is also installed, whereas pip only installs Python packages. For Qt5, install PyQt5 or PySide5; for Qt6 install PyQt6 or PySide6.

Open a terminal and type the following commands (on Windows look for the Anaconda Prompt in the Start Menu):

conda create -n nupylab
conda activate nupylab
conda install PySide6
pip install nupylab

This will install NUPyLab and all the required dependencies. You can verify the installation with pip show nupylab.

Installing VISA

Many instruments communicate through a VISA adapter, which requires either the VISA library provided by a vendor like National Instruments, or the pure Python backend PyVISA-Py. See the PyVISA documentation for more information about configuring the backend. In most cases it is sufficient to allow PyVISA to automatically select the backend, which will choose IVI if available, PyVISA-Py if not. PyVISA-Py is listed as a dependency of NUPyLab, so most instruments should work out of the box.

Contributing

If you want to add an instrument driver, create a new station GUI, or otherwise edit the NUPyLab code, you can contribute to the GitHub repository:

  1. Install git on your computer, e.g. conda install git

  2. Fork the hailegroup/nupylab repository on GitHub

  3. Remove any previous NUPyLab installation with pip uninstall nupylab

  4. Download your forked repository with git clone https://github.com/<your-name>/nupylab.git

  5. Change the current working directory to the location of the clone

  6. Install NUPyLab in editable mode: pip install -e .

  7. Create a new git branch for your feature and submit a pull request with your edits

See Creating a New Station GUI for more information.