installation issue: labscript-profile-create gives an error in Ubuntu 18.04 LTS

101 views
Skip to first unread message

Andreas Trenkwalder

unread,
Mar 28, 2021, 6:33:12ā€ÆPM3/28/21
to the labscript suite
Hi, I am new to labscript.

I would like to check the possibility to implement my FPGA-SoC based I/O device as a new labscript device. But I already get errors during installation.

I tried on two machines both with Ubuntu 18.04 LTS and get the same error.


on the "labscript-profile-create" it throws an error "TypeError: argument of type 'PosixPath' is not iterable".

I have not modified any configuration file.

Up to this point there were no errors, only the venv I had to create with "python3 -m venv .venv" and I use this line to start venv: "source .venv/bin/activate". I am neither an expert with Python nor have used a virtual environment before.

I am not even sure if its a labscript problem or a problem with my python configuration. But it happens on two machines (they are both up-to-date).

The file it loads is:
/home/andi/labscript-suite/labconfig/andi-ThinkPad-E14.ini
The option is:
userlib
The entry in the andi-ThinkPad-E14.ini is:
userlib = %(labscript_suite)s/userlib

After this it calls some Python3.6 code outside the virtual environment (should it do this?) and I am not sure what is going on.

What can be done?
Thanks in advance!
Andreas

Here the stack trace:
*****************************************************
(.venv) andi@andi-ThinkPad-E14:~/Andi/programming/labscript-suite$ labscript-profile-create
Error processing line 1 of /home/andi/Andi/programming/labscript-suite/.venv/lib/python3.6/site-packages/labscript-suite.pth:

Ā  Traceback (most recent call last):
Ā Ā Ā  File "/usr/lib/python3.6/site.py", line 174, in addpackage
Ā Ā Ā Ā Ā  exec(line)
Ā Ā Ā  File "<string>", line 1, in <module>
Ā Ā Ā  File "<string>", line 1, in <module>
Ā Ā Ā  File "/home/andi/Andi/programming/labscript-suite/.venv/lib/python3.6/site-packages/labscript_profile/__init__.py", line 56, in add_userlib_and_pythonlib
Ā Ā Ā Ā Ā  paths = config.get('DEFAULT', option).split(',')
Ā Ā Ā  File "/usr/lib/python3.6/configparser.py", line 800, in get
Ā Ā Ā Ā Ā  d)
Ā Ā Ā  File "/usr/lib/python3.6/configparser.py", line 394, in before_get
Ā Ā Ā Ā Ā  self._interpolate_some(parser, option, L, value, section, defaults, 1)
Ā Ā Ā  File "/usr/lib/python3.6/configparser.py", line 435, in _interpolate_some
Ā Ā Ā Ā Ā  if "%" in v:
Ā  TypeError: argument of type 'PosixPath' is not iterable

Remainder of file ignored
Error processing line 1 of /home/andi/Andi/programming/labscript-suite/.venv/lib/python3.6/site-packages/labscript-suite.pth:

Ā  Traceback (most recent call last):
Ā Ā Ā  File "/usr/lib/python3.6/site.py", line 174, in addpackage
Ā Ā Ā Ā Ā  exec(line)
Ā Ā Ā  File "<string>", line 1, in <module>
Ā Ā Ā  File "<string>", line 1, in <module>
Ā Ā Ā  File "/home/andi/Andi/programming/labscript-suite/.venv/lib/python3.6/site-packages/labscript_profile/__init__.py", line 56, in add_userlib_and_pythonlib
Ā Ā Ā Ā Ā  paths = config.get('DEFAULT', option).split(',')
Ā Ā Ā  File "/usr/lib/python3.6/configparser.py", line 800, in get
Ā Ā Ā Ā Ā  d)
Ā Ā Ā  File "/usr/lib/python3.6/configparser.py", line 394, in before_get
Ā Ā Ā Ā Ā  self._interpolate_some(parser, option, L, value, section, defaults, 1)
Ā Ā Ā  File "/usr/lib/python3.6/configparser.py", line 435, in _interpolate_some
Ā Ā Ā Ā Ā  if "%" in v:
Ā  TypeError: argument of type 'PosixPath' is not iterable

Remainder of file ignored
*****************************************************

Chris Billington

unread,
Mar 28, 2021, 8:30:10ā€ÆPM3/28/21
to labscri...@googlegroups.com
Hi Andreas,

Thanks for letting us know about the issue.

Sounds like a bug in our code on Python 3.6, where Path objects aren't automatically converted to strings (whereas they are on later versions of Python, which we have tested more with).

If you modify .../.venv/lib/python3.6/site-packages/labscript_profile/__init__.py to convertĀ LABSCRIPT_SUITE_PROFILE to a string as in the below diff, does that fix theĀ problem?

Cheers,

Chris

----

diff --git a/labscript_profile/__init__.py b/labscript_profile/__init__.py
index a679ff5..5ce4096 100644
--- a/labscript_profile/__init__.py
+++ b/labscript_profile/__init__.py
@@ -49,7 +49,9 @@ def add_userlib_and_pythonlib():
Ā  Ā  Ā time the interpreter starts up"""
Ā  Ā  Ā labconfig = default_labconfig_path()
Ā  Ā  Ā if labconfig is not None and labconfig.exists():
- Ā  Ā  Ā  Ā config = ConfigParser(defaults={'labscript_suite': LABSCRIPT_SUITE_PROFILE})
+ Ā  Ā  Ā  Ā config = ConfigParser(defaults={'labscript_suite': str(LABSCRIPT_SUITE_PROFILE)})
Ā  Ā  Ā  Ā  Ā config.read(labconfig)
Ā  Ā  Ā  Ā  Ā for option in ['userlib', 'pythonlib']:
Ā  Ā  Ā  Ā  Ā  Ā  Ā try:



--
You received this message because you are subscribed to the Google Groups "the labscript suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to labscriptsuit...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/labscriptsuite/e10772e0-4c54-443b-8832-f176644eb41cn%40googlegroups.com.

Chris Billington

unread,
Mar 28, 2021, 8:39:32ā€ÆPM3/28/21
to labscri...@googlegroups.com
As for the code outside the venv running, I think that's how venvs work in some circumstances - they use the Python standard library from the "system" Python installation rather than copying it into the venv. This may have changed with later versions of python, but in any case doesn't indicate anything wrong.

-Chris

Andreas Trenkwalder

unread,
Mar 29, 2021, 2:55:31ā€ÆAM3/29/21
to labscri...@googlegroups.com
Hi Chris, thanks for your fast answer!

yes, indeed changing the line 54 in
.venv/lib/python3.6/site-packages/labscript-profile/__init__.py to:
config = ConfigParser(defaults={'labscript_suite':
str(LABSCRIPT_SUITE_PROFILE)})
removes the error!

I have got another error "FileExistsError:
/home/andi/labscript-suite/userlib" but after renaming the
labscript-suite folder in the home directory it created a new one
without errors.

I will in the next days/weeks check if I can implement my device with
labscript. We are considering to migrate our lab control system to
something else than Labview and LabWindows/CVI and labscript seems a
viable option if I get my device running with it.

Many thanks!
Andreas

On Mon, Mar 29, 2021 at 2:39 AM Chris Billington
> You received this message because you are subscribed to a topic in the Google Groups "the labscript suite" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/labscriptsuite/73I4s29In40/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to labscriptsuit...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/labscriptsuite/CAKy3cVvp3B6OeKP9mOyJndt0uogiUYv354KV2ng%3Dc4Bty8D1Sw%40mail.gmail.com.

Andreas Trenkwalder

unread,
Apr 4, 2021, 7:32:57ā€ÆAM4/4/21
to the labscript suite
Hi, I finally manged to get runmanager and blacs running without errors but it took me several days to come to this point.

I want to share what is needed to get it running for Python 3.6 on Ubuntu 18.04 LTS:

1. in .venv/lib/python3.6/site-packages/labscript-profile/__init__.py
line 52 change from:
config = ConfigParser(defaults={'labscript_suite': LABSCRIPT_SUITE_PROFILE})
to:
config = ConfigParser(defaults={'labscript_suite': str(LABSCRIPT_SUITE_PROFILE)})

2. .venv/lib/python3.6/site-packages/labscript_utils/labconfig.py
lineĀ  40 change from:
self, config_path=default_config_path, required_params=None, defaults=None,
to:
self, config_path=str(default_config_path), required_params=None, defaults=None,
line 46 change from:
defaults['labscript_suite'] = LABSCRIPT_SUITE_PROFILE
to:
defaults['labscript_suite'] = str(LABSCRIPT_SUITE_PROFILE)

3. (optional) in .venv/lib/python3.6/site-packages/labscript/labscript.py
line 2541 change from:
compiler.save_hg_info = True
to:
compiler.save_hg_info = False
line 2561 change from:
save_hg_info = True
to:
save_hg_info = False

4. in connection_table.py [blank when opened the first time from blacs menu and selected to edit]
copy into this file your entire experiment script as for example the one in the figure:
I think you can remove all of the Experimental logic but *** most importantly *** keep the start() and stop(2) commands!
the time given to stop should not matter but has to be > 0.
it would be very helpful to have an example figure on the next page of the docs:

5. (optional) in .venv/lib/python3.6/site-packages/labscript/labscript.py (2nd modification of this file)
line 2194 change from:
save_path = 'labscriptlib/' + path.replace(prefix, '').replace('\\', '/').replace('//', '/')
to:
save_path = ('labscriptlib/' + path.replace(prefix, '').replace('\\', '/')).replace('//', '/')

#############################################################

the line numbers might be slightly off since I inserted here and there print commands.

1. and 2 fix the error: "TypeError: argument of type 'PosixPath' is not iterable"
3. fixes the error "FileNotFoundError: [Errno 2] No such file or directory: 'hg': 'hg'" which happens when Mercurial is not installed [nothing in docs about this dependency]
4. fixes the error on startup of blacs or after recompilation of the connection table: "KeyError: "Unable to open object (object 'connection table' doesn't exist)""
this was the error which took me the most time to find and banging my head against walls since runmanager could compile it with the 'connection table' in the h5 file
while blacs failed using the exact same functions for compilation.
The connection_table.py file needs the start() and stop() entries to compile properly!
please insert this info into the docs or as an example file in the suite! it's neither in one of the thesis nor in the docs.
5. is a possible bug which I found during tracking of error 4. On my system the '//' were not replaced by single '/' otherwise. But it seems not to matter and does not cause errors.

another note: hdfview does not show any content of the h5 file although according to the thesis it should:
is this because the file is encrypted or do I have the wrong viewer (HDFView 2.11)

Thanks,
Andreas

Andreas Trenkwalder

unread,
Apr 4, 2021, 9:01:56ā€ÆAM4/4/21
to labscri...@googlegroups.com
one correction:

in the folder ~/labscript-suite/userlib/labscriptlib/example_apparatus there are actually 2 example connection table files with the start() and stop() commands which I have missed.

The docs could still contain another example.

Andreas

Reply all
Reply to author
Forward
0 new messages