blei-lab / edward

A probabilistic programming language in TensorFlow. Deep generative models, variational inference.
http://edwardlib.org
Other
4.83k stars 759 forks source link

constrain tensorflow version #940

Open andy-esch opened 5 years ago

andy-esch commented 5 years ago

When installing edward using the default method (pip install edward) and using the tensorflow versions specified in the setup.py (tensorflow>=1.2.0rc0), I get the following for some of the get started code:

ModuleNotFoundError: No module named 'tensorflow.contrib'

Since Tensorflow released a v2.0 that has a different API, looks like the tensorflow dependency should be constrained to be <2.0 as is done here. This seems to work as expected but https://github.com/blei-lab/edward/issues/882 is showing up when I run examples from the notebooks directory and elsewhere so perhaps this should be constrained further or that issue could be fixed in a separate PR.

Stacktrace --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in 1 import tensorflow as tf ----> 2 from edward.models import Normal 3 4 W_0 = Normal(loc=tf.zeros([1, 2]), scale=tf.ones([1, 2])) 5 W_1 = Normal(loc=tf.zeros([2, 1]), scale=tf.ones([2, 1])) ~/.local/share/virtualenvs/ed-61OcBILj/lib/python3.7/site-packages/edward/__init__.py in 3 from __future__ import print_function 4 ----> 5 from edward import criticisms 6 from edward import inferences 7 from edward import models ~/.local/share/virtualenvs/ed-61OcBILj/lib/python3.7/site-packages/edward/criticisms/__init__.py in 5 from __future__ import print_function 6 ----> 7 from edward.criticisms.evaluate import * 8 from edward.criticisms.ppc import * 9 from edward.criticisms.ppc_plots import * ~/.local/share/virtualenvs/ed-61OcBILj/lib/python3.7/site-packages/edward/criticisms/evaluate.py in 7 import tensorflow as tf 8 ----> 9 from edward.models import RandomVariable 10 from edward.util import check_data, get_session, compute_multinomial_mode, \ 11 with_binary_averaging ~/.local/share/virtualenvs/ed-61OcBILj/lib/python3.7/site-packages/edward/models/__init__.py in 5 from __future__ import print_function 6 ----> 7 from edward.models.dirichlet_process import * 8 from edward.models.empirical import * 9 from edward.models.param_mixture import * ~/.local/share/virtualenvs/ed-61OcBILj/lib/python3.7/site-packages/edward/models/dirichlet_process.py in 6 7 from edward.models.random_variable import RandomVariable ----> 8 from tensorflow.contrib.distributions import Distribution 9 10 try: ModuleNotFoundError: No module named 'tensorflow.contrib'
harishkashyap commented 2 years ago

+1 to this. This library didnt work on latest tensorflow 2.2+ and python3.8+. The older versions are missing links and so pip is also unable to find them. Best is to upgrade the library to work with latest python and tensorflow.