lalinference uninstallable due to "io" package conflicting with standard library module with the same name
I've been trying to switch my work environment over to Python 3 and lalinference is uninstallable. The specific error message from make install
is
/bin/mkdir -p '/home/kipp/local/lib/python3.7/site-packages/lalinference'
/usr/bin/install -c -m 644 __init__.py distance.py healpix_tree.py lalinference_pipe_utils.py moc.py nest2pos.py wrapper.py bayespputils.py git_version.py '/home/kipp/local/lib/python3.7/site-packages/lalinference'
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
File "/home/kipp/Development/lalsuite/lalinference/python/lalinference/io/__init__.py", line 20, in <module>
ModuleNotFoundError: No module named 'six'
../../gnuscripts/py-compile: line 136: 662236 Aborted $PYTHON -c "
import sys, os, py_compile, imp
files = '''$files'''
sys.stdout.write('Byte-compiling python modules...\n')
for file in files.split():
$pathtrans
$filetrans
if not os.path.exists(filepath) or not (len(filepath) >= 3
and filepath[-3:] == '.py'):
continue
sys.stdout.write(file)
sys.stdout.flush()
if hasattr(imp, 'get_tag'):
py_compile.compile(filepath, imp.cache_from_source(filepath), path)
else:
py_compile.compile(filepath, filepath + 'c', path)
sys.stdout.write('\n')"
make[3]: *** [Makefile:806: install-pymodulePYTHON] Error 134
make[3]: Leaving directory '/home/kipp/Development/lalsuite/lalinference/python/lalinference'
the Fatal Python error: init_sys_streams: can't initialize sys standard streams
occurs because there is a thing called "io" in the tree. "io" conflicts with a module by the same name in the Python standard library, and the presence of that directory in the lalinference tree borks the Python interpreter because it apparently tries to import it as part of the install process.
The following "fixes" the problem for me: rename the directory "io" and remove references to it from the Makefile
diff --git a/lalinference/python/lalinference/Makefile.am b/lalinference/python/lalinference/Makefile.am
index 136a2b9f3a..78b6acfaa9 100644
--- a/lalinference/python/lalinference/Makefile.am
+++ b/lalinference/python/lalinference/Makefile.am
@@ -7,7 +7,6 @@ include $(top_srcdir)/gnuscripts/lalsuite_vcs_info.am
SUBDIRS = \
bayestar \
imrtgr \
- io \
plot \
tiger \
util \
I am baffled how this can possibly work for anybody. "io" was added in Python 2.6, so this isn't a Python 3 problem, specifically, but I've only encountered it with Python 3. The name collision is certainly real, and eliminating the name collision fixes the install for me. I just can't explain why I am only encountering it now, and, apparently, nobody else is. I'm using python 3.7, CIT is on 3.6, maybe the problem is new in 3.7? In any case, I'm sure the package in lalinference needs to have its name changed. It can't be called "io", there's already a thing called that.