Ham82
Ham82

Reputation: 665

No module named 'tensorflow_probability'

I need to use Tensorflow and Tensorflow_Probability. After installing it by these commands: conda install tensorflow-probability or pip install --upgrade tensorflow-probability , I ran it in the notebook:

import tensorflow_probability as tfp

but it returns this error:

    ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-8-41494c8c96ff> in <module>
----> 1 import tensorflow_probability as tfp

ModuleNotFoundError: No module named 'tensorflow_probability'.

The results of

pip list

is as below (related parts):

tblib                              1.3.2
tensorboard                        1.13.1
tensorflow                         1.13.1
tensorflow-estimator               1.13.0
tensorflow-probability             0.7.0
termcolor                          1.1.0
terminado                          0.8.1
testpath                           0.4.2
tfp-nightly                        0.8.0.dev20190708
Theano                             1.0.4
toolz                              0.9.0

Can anyone help me to solve this problem (I am using Win 10)?

Upvotes: 13

Views: 38793

Answers (3)

Paradigm
Paradigm

Reputation: 498

As the previous answer, you have to find a version compatible with your TensorFlow version through this page: https://github.com/tensorflow/probability/releases

Upvotes: 1

Neeraj Jain
Neeraj Jain

Reputation: 648

tensorflow-probability 0.7.0 is not compatible with: tensorflow 1.13.1 check the tensoflow-probability version release page https://github.com/tensorflow/probability/releases

Correct solution will be either to upgrade tensorflow to 1.14.0 or downgrade tensorflow-probability to 0.6.0

pip install -U tensorflow-probability==0.6.0

Upvotes: 6

amalik2205
amalik2205

Reputation: 4162

Your versions are correct and your command is correct too.

Seems like inconsistency in other module is causing this.

run the following commands and try again:

pip install -U dm-sonnet==1.23
pip install --upgrade tfp-nightly

References: https://github.com/deepmind/graph_nets/issues/3 https://github.com/tensorflow/probability/issues/103

Upvotes: 11

Related Questions