ImportError: cannot import name gen_distribution_ops
See original GitHub issueWhen 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)
Issue Analytics
- State:
- Created 5 years ago
- Comments:19 (7 by maintainers)
Top Results From Across the Web
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >What can I do about "ImportError: Cannot import name X" or ...
You have circular dependent imports. physics.py is imported from entity before class Ent is defined and physics tries to import entity that is...
Read more >cannot import name 'remote_pb2' from 'securexgboost.rpc ...
I am getting the following error importing securexgboost: secureml@fml-30294-westus2-sxgb-poc-sgxvm:~$ python3 Python 3.7.5 (default, ...
Read more >How to Fix : “ImportError: Cannot import name X” in Python?
You can solve the “ ImportError : Cannot import name X” Error by resolving the circular dependencies. You can do that either by...
Read more >cannot import name 'file_hash' from 'pooch.utils' - YouTube
How to resolve ImportError : cannot import name 'file_hash' from 'pooch.utils'
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mtthss The
gen_distribution_ops.so
seems 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