Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

2 labscript installs simulatenously?

37 views
Skip to first unread message

Ashrit Verma

unread,
Aug 26, 2024, 5:51:07 PM8/26/24
to the labscript suite
Is there any way to have two labscript installs on the same machine?

Error: when try to run "labscript-profile-create" on new install, get the following error:
(labscript_new) PS C:\Users\RoyDAQ\Documents\labscript_new\scripts>
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_m
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_co
    exec(code, run_globals)
  File "C:\Users\RoyDAQ\Documents\labscript_new\scripts\labscript-pr
  File "C:\Users\RoyDAQ\Documents\labscript_new\src\labscript-utils\
file
    raise FileExistsError(dest_file)
FileExistsError: C:\Users\RoyDAQ\labscript-suite\app_saved_configs


If proceed without creating new profile in the new labscript install, blacs gives the following error for each device except NI cards:
Traceback (most recent call last):
  File "C:\Users\RoyDAQ\Documents\labscript_new\src\labscript-utils\labscript_utils\device_registry\_device_registry.py", line 122, in __getitem__
    importlib.import_module('.' + name, 'labscript_devices')
  File "C:\Program Files\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'labscript_devices.HP8673B'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "c:\users\roydaq\documents\labscript_new\lib\site-packages\zprocess\utils.py", line 122, in _reraise
    raise value.with_traceback(traceback)
  File "C:\Users\RoyDAQ\Documents\labscript_new\src\blacs\blacs\__main__.py", line 271, in __init__
    TabClass = device_registry.get_BLACS_tab(labscript_device_class_name)
  File "C:\Users\RoyDAQ\Documents\labscript_new\src\labscript-utils\labscript_utils\device_registry\_device_registry.py", line 215, in get_BLACS_tab
    return BLACS_tab[name]
  File "C:\Users\RoyDAQ\Documents\labscript_new\src\labscript-utils\labscript_utils\device_registry\_device_registry.py", line 134, in __getitem__
    raise ImportError(msg)
ImportError: No BLACS_tab registered for a device named HP8673B. Ensure that there is a file 'register_classes.py' with a call to labscript_devices.register_classes() for this device, with the device name passed to register_classes() matching the name of the device class. Fallback method of looking for and importing a module in labscript_devices with the same name as the device also failed. If using this method, check that the module exists, has the same name as the device class, and can be imported with no errors. Import error was:
Traceback (most recent call last):
  File "C:\Users\RoyDAQ\Documents\labscript_new\src\labscript-utils\labscript_utils\device_registry\_device_registry.py", line 122, in __getitem__
    importlib.import_module('.' + name, 'labscript_devices')
  File "C:\Program Files\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'labscript_devices.HP8673B'


Purpose: made backend changes to speed up labscript and want to install these custom edits onto machine without losing the capability of the previous version that works as is, albeit very slowly

dihm....@gmail.com

unread,
Aug 30, 2024, 2:50:07 PM8/30/24
to the labscript suite
There are a few layers of answer to this.

1) Completely independent, simultaneous installs: not without modifying source code. Issue is that labscript defaults to the prescribed location for the config files. You could potentially modify the relevant code in labscript-utils to change where it looks, and then make a copy of the profile directory to the new location and make edits. That may work, but you'll have to possible worry about the zlock and zlog servers which would possibly still be shared between installations without some careful thought. In any case, I would not recommend this path.
2) Two source code installations, sharing a config/profile directory: So long as the configs for both of your installations are the same, this can work fairly well (ie having two conda environments with labscript installed and switching between them). You only need to run the profile creation once, and both installations will look there natively. Actively switching between both can be problematic though things like app saved configs could become an issue when switching. I often do this for one-off incidental tests, would not be my preferred path but it is serviceable.
3) Local branches on working repositories: This is the canonical way to do this. Just install labscript in developer mode, and maintain two branches: one for mainline, one for your local lab changes. Switching which installation you are using is nominally as simple as checking out a new branch. In most respects, this is identical to option 2, but is the software engineering (TM) way to do it. I would highly recommend this path unless you have a compelling reason.

Hopefully that is helpful. As for the errors, first case is because the labscript profile create only writes to the default directory. That could be manually changed in the source, but you would still need to basically implement option 1 for it to work correctly. For the second case, (which I assume is basically option 2) I suspect there is a path issue of some kind. The ImportError buried in the middle of the traceback is giving the best advice for how to proceed. If that doesn't work, you may also have some path differences between the config for both installations that need to be changed before switching between installs.

Finally, I would be very interested to hear about these speed ups. It's a common issue that would be nice to solve for the wider community, assuming your changes are not too optimized for your exact experimental needs.

-David

Reply all
Reply to author
Forward
0 new messages