-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Hi All,
I'm attempting to get labscript running on a new computer with an anaconda developer install on Windows. The installation runs fine but I'm not able to import userlib
, even after running labscript-profile-create
. Instead I get ModuleNotFoundError: No module named 'userlib'
. This occurs even with the default values in the labconfig. I'm able to import pythonlib
just fine though.
In an interactive session I checked sys.path
and it included C:\Users\UserName\labscript-suite\userlib
and C:\Users\UserName\labscript-suite\userlib\pythonlib
. I tried editing sys.path
to move each of those up one directory, so sys.path
then contained C:\Users\UserName\labscript-suite
and C:\Users\UserName\labscript-suite\userlib
. After that I was able to import both userlib
and pythonlib
in that interactive session without error.
Maybe the parent directories of userlib
and pythonlib
should be added to path instead?
labscript-utils/labscript_profile/__init__.py
Lines 44 to 60 in 2c7deba
def add_userlib_and_pythonlib(): | |
"""Find the users's labconfig file, read the userlib and pythonlib keys, and add | |
those directories to the Python search path. This function intentionally | |
re-implements finding and reading the config file so as to not import | |
labscript_utils, since we dont' want to import something like labscript_utils every | |
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.read(labconfig) | |
for option in ['userlib', 'pythonlib']: | |
try: | |
paths = config.get('DEFAULT', option).split(',') | |
except (NoSectionError, NoOptionError): | |
paths = [] | |
for path in paths: | |
site.addsitedir(path) |
Somewhat related: #43
This seems like an issue that others would have run into before so there may be something different about my set up somehow. Maybe it's because this computer never had a mercurial install of labscript on it? I checked sys.path
on one of our other computers which still has a mercurial labscript install on it, and it included the paths to all three of C:\Users\UserName\labscript-suite
, C:\Users\UserName\labscript-suite\userlib
and C:\Users\UserName\labscript-suite\userlib\pythonlib
,
Cheers,
Zak