sacred: Sacred is not compatible with TensorFlow 1.14.0
TensorFlow 1.14.0 was released couple of days ago and it isn’t unfortunately compatible with sacred. Tensorflow package in 1.14.0 has __spec__
property set to None, which results in exception in pkgutil.find_loader
when one imprts sacred.
I’m not sure whether this is a bug/feature on tensorflow, however the fact that it breaks sacred is unfortunate.
$ docker run -it tensorflow/tensorflow:1.14.0-py3 bash
root@d70a18c72a0b:/# pip install sacred
Successfully installed colorama-0.4.1 docopt-0.6.2 jsonpickle-0.9.6 munch-2.3.2 packaging-19.0 py-cpuinfo-5.0.0 pyparsing-2.4.0 sacred-0.7.5
root@d70a18c72a0b:/# python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'1.14.0'
>>> import sacred
Traceback (most recent call last):
File "/usr/lib/python3.6/pkgutil.py", line 490, in find_loader
spec = importlib.util.find_spec(fullname)
File "/usr/lib/python3.6/importlib/util.py", line 102, in find_spec
raise ValueError('{}.__spec__ is None'.format(name))
ValueError: tensorflow.__spec__ is None
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/sacred/__init__.py", line 13, in <module>
from sacred.experiment import Experiment
File "/usr/local/lib/python3.6/dist-packages/sacred/experiment.py", line 13, in <module>
from sacred.arg_parser import format_usage, get_config_updates
File "/usr/local/lib/python3.6/dist-packages/sacred/arg_parser.py", line 16, in <module>
from sacred.serializer import restore
File "/usr/local/lib/python3.6/dist-packages/sacred/serializer.py", line 8, in <module>
from sacred import optional as opt
File "/usr/local/lib/python3.6/dist-packages/sacred/optional.py", line 40, in <module>
has_tensorflow = modules_exist("tensorflow")
File "/usr/local/lib/python3.6/dist-packages/sacred/utils.py", line 656, in modules_exist
return all(module_exists(m) for m in modnames)
File "/usr/local/lib/python3.6/dist-packages/sacred/utils.py", line 656, in <genexpr>
return all(module_exists(m) for m in modnames)
File "/usr/local/lib/python3.6/dist-packages/sacred/utils.py", line 652, in module_exists
return pkgutil.find_loader(modname) is not None
File "/usr/lib/python3.6/pkgutil.py", line 496, in find_loader
raise ImportError(msg.format(fullname, type(ex), ex)) from ex
ImportError: Error while finding loader for 'tensorflow' (<class 'ValueError'>: tensorflow.__spec__ is None)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 18
Commits related to this issue
- Pin tensorflow < 1.14 for compatibility with sacred https://github.com/IDSIA/sacred/issues/493 — committed to songlab-cal/tape-neurips2019 by thomas-a-neil 5 years ago
Just as you would install any Python package from github, in this case
pip install git+https://github.com/IDSIA/sacred.git
. See https://stackoverflow.com/questions/20101834/pip-install-from-git-repo-branch for more details on the options for installing from github with pip.I can reproduce the exact above stack-trace using 1.14 (GPU Version).
Installing from master should work at the moment as I hotfixed the issue.
Known workaround in the meantime?