trfl: ImportError: cannot import name gen_distribution_ops
When I try to import trfl, similarly to this public trfl colab notebook online, I get
(Note I tried this in both python 2 and 3 notebooks, met with the same results)
<ipython-input-3-dd69192d7d7c> in <module>()
----> 1 import trfl
/usr/local/lib/python2.7/dist-packages/trfl/__init__.py in <module>()
29 from trfl.discrete_policy_gradient_ops import discrete_policy_gradient_loss
30 from trfl.discrete_policy_gradient_ops import sequence_advantage_actor_critic_loss
---> 31 from trfl.dist_value_ops import categorical_dist_double_qlearning
32 from trfl.dist_value_ops import categorical_dist_qlearning
33 from trfl.dist_value_ops import categorical_dist_td_learning
/usr/local/lib/python2.7/dist-packages/trfl/dist_value_ops.py in <module>()
31 import tensorflow as tf
32 from trfl import base_ops
---> 33 from trfl import distribution_ops
34
35 Extra = collections.namedtuple("dist_value_extra", ["target"])
/usr/local/lib/python2.7/dist-packages/trfl/distribution_ops.py in <module>()
28 import tensorflow as tf
29 import tensorflow_probability as tfp
---> 30 from trfl import gen_distribution_ops
31
32
ImportError: cannot import name gen_distribution_ops
(Also, if I install trfl via pip instead of cloning from git, error messages look similar with this added on the end)
/usr/local/lib/python2.7/dist-packages/trfl/gen_distribution_ops.py in <module>()
1 import tensorflow as tf
----> 2 _op_lib = tf.load_op_library(tf.resource_loader.get_path_to_datafile("_gen_distribution_ops.so"))
3 project_distribution = _op_lib.project_distribution
4 del _op_lib, tf
/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/load_library.pyc in load_op_library(library_filename)
59 RuntimeError: when unable to load the library or get the python wrappers.
60 """
---> 61 lib_handle = py_tf.TF_LoadLibrary(library_filename)
62
63 op_list_str = py_tf.TF_GetOpList(lib_handle)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (8 by maintainers)
@mtthss The
gen_distribution_ops.soseems to be missing when installing in a fresh environment with TF 13.1 and TF-Probability 0.6 on macOS.@akanksha95, @abdel,
we now have pre-built binaries for both MacOS and Ubuntu you can install them with
pip install trfl