Hi!
Every time I run a code more than once with tensorflow_probability imported I get the following error:
import tensorflow_probability
Traceback (most recent call last):
File “”, line 1, in
import tensorflow_probability
File “/home/slevy/Desktop/probability/tensorflow_probability/init.py”, line 23, in
from tensorflow_probability.python import * # pylint: disable=wildcard-import
File “/home/slevy/Desktop/probability/tensorflow_probability/python/init.py”, line 142, in
dir(globals()[pkg_name]) # Forces loading the package from its lazy loader.
File “/home/slevy/Desktop/probability/tensorflow_probability/python/internal/lazy_loader.py”, line 61, in dir
module = self._load()
File “/home/slevy/Desktop/probability/tensorflow_probability/python/internal/lazy_loader.py”, line 44, in _load
module = importlib.import_module(self.name)
File “/home/slevy/anaconda3/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “/home/slevy/Desktop/probability/tensorflow_probability/python/experimental/init.py”, line 35, in
from tensorflow_probability.python.experimental import bijectors
File “/home/slevy/Desktop/probability/tensorflow_probability/python/experimental/bijectors/init.py”, line 19, in
from tensorflow_probability.python.experimental.bijectors.distribution_bijectors import make_distribution_bijector
File “/home/slevy/Desktop/probability/tensorflow_probability/python/experimental/bijectors/distribution_bijectors.py”, line 25, in
from tensorflow_probability.python.distributions import deterministic
File “/home/slevy/Desktop/probability/tensorflow_probability/python/distributions/init.py”, line 23, in
from tensorflow_probability.python.distributions.autoregressive import Autoregressive
File “/home/slevy/Desktop/probability/tensorflow_probability/python/distributions/autoregressive.py”, line 30, in
from tensorflow_probability.python.util.seed_stream import SeedStream
File “/home/slevy/Desktop/probability/tensorflow_probability/python/util/init.py”, line 23, in
from tensorflow_probability.python.util.deferred_tensor import DeferredTensor
File “/home/slevy/Desktop/probability/tensorflow_probability/python/util/deferred_tensor.py”, line 738, in
class _DeferredTensorSpec(_DeferredTensorSpecBase, type_spec.BatchableTypeSpec):
File “/home/slevy/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/type_spec.py”, line 713, in decorator_fn
_NAME_TO_TYPE_SPEC[name].name))
ValueError: Name tfp.util.DeferredTensorSpec has already been registered for class tensorflow_probability.python.util.deferred_tensor._DeferredTensorSpec.
I couldn’t find any discussions on this error anywhere, what can I do to fix it? It’s really annoying to restart the kernel each time to run my code.
Thanks in advance!