Unable to import distributions module from Tensorflow (Dockerized)

157 views Asked by At

I'm running the official TF docker repo using the Jupyter UI on localhost. It seems that TF is working in general, as I am able to import it, but when trying to import the distributions module I get an error:

print tf.__version__
import tf.distributions as dist

1.8.0

ImportErrorTraceback (most recent call last)
<ipython-input-3-4d440943cb46> in <module>()
      1 print tf.__version__
----> 2 import tf.distributions as dist

ImportError: No module named tf.distributions
1

There are 1 answers

0
squadrick On

Try this

import tensorflow as tf
from tensorflow import distributions as dist

I don't think you can use import aliases for other import statements in python. I'm not too sure about this, but I think that's the problem.

FYI, I tested this on Python 3.5.2 and Tensorflow 1.8.0