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

Error importing edward 1.3.5 with tensorflow 1.7.0 #882

Open bjfar opened 6 years ago

bjfar commented 6 years ago

I have tensorflow 1.7.0 built from source and installed, and it seems to work ok by itself, but I cannot import edward:

>>> import tensorflow
/home/farmer/anaconda3/envs/general/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
>>> print(tensorflow.__version__)
1.7.0
>>> import edward
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/farmer/anaconda3/envs/general/lib/python3.6/site-packages/edward/__init__.py", line 5, in <module>
    from edward import criticisms
  File "/home/farmer/anaconda3/envs/general/lib/python3.6/site-packages/edward/criticisms/__init__.py", line 7, in <module>
    from edward.criticisms.evaluate import *
  File "/home/farmer/anaconda3/envs/general/lib/python3.6/site-packages/edward/criticisms/evaluate.py", line 10, in <module>
    from edward.util import check_data, get_session, compute_multinomial_mode, \
  File "/home/farmer/anaconda3/envs/general/lib/python3.6/site-packages/edward/util/__init__.py", line 10, in <module>
    from edward.util.random_variables import *
  File "/home/farmer/anaconda3/envs/general/lib/python3.6/site-packages/edward/util/random_variables.py", line 15, in <module>
    from tensorflow.python.framework.ops import set_shapes_for_outputs
ImportError: cannot import name 'set_shapes_for_outputs'

I am on Ubuntu 16.04 LTS and using the edward version installed via pip, which appears to be 1.3.5:

$ pip show edward
Name: edward
Version: 1.3.5
Summary: A library for probabilistic modeling, inference, and criticism
Home-page: http://edwardlib.org
Author: Dustin Tran
Author-email: dustin@cs.columbia.edu
License: Apache License 2.0
Location: /home/farmer/anaconda3/envs/general/lib/python3.6/site-packages
Requires: six, numpy

I was going to try building edward from source, but the latest tagged version seems to be 1.3.5 anyway so I guess this will not help. My Python version is 3.6.4.

edit: Ah, although if I install tensorflow via pip (which also seems to be version 1.7.0) then edward does work. This seems odd to me... I guess something could be wrong with my tensorflow build, but it seems to work. I wanted to build it from source since the pip version doesn't use various vectorisation options that my CPU can do.

dustinvtran commented 6 years ago

Looks like the function no longer exists in TF 1.7.0. Following the commit, we may be able to just remove it in the ed.copy implementation (https://github.com/tensorflow/tensorflow/commit/9fc9f19428e497f3a297538059804f69996a612e#diff-66fbf57743aed7c8407bcb218db3c491L2477).

andersdot commented 6 years ago

I'm having the same issue, any updates on this?

sadatnfs commented 6 years ago

TF 1.8.0 has been released, I wonder how much other changes have been in TF that Edward would need.. :/

sunny1205124 commented 6 years ago

I tried to use the lower versions of TF and edward, then I can import both TF and edward successfully now. But for TF1.7.0 and 1.8.0, the same problem with you.

hiraksarkar commented 6 years ago

Any fix yet?

diego-vicente commented 6 years ago

Having the same problem with tensorflow 1.8.0 built from source

IanQS commented 6 years ago

If you follow this PR you'll see followups. I'm not sure if there's a discussion on another platform (if there is please let me know I'd love to see and contribute to solving this issue)

larsr commented 6 years ago

I noticed that set_shapes_for_outputs now (since 9fc9f19428e497f3a) seems to be called set_shape_and_handle_data_for_outputs

See a kludge solution here

IanQS commented 6 years ago

@larsr Can you try running the tests? Because I'm pretty sure I tried that and it failed the copy tests

larsr commented 6 years ago

@IanQS yeah, I did cd edward/tests; pytest . and got "86 failed, 240 passed, 44 warnings". In particular pytest util/copy_test.py got 20 failed and 3 passed. Alas, there are more things to take care of.

devinbostIL commented 6 years ago

I installed TensorFlow via pip and still got this problem.

devinbostIL commented 6 years ago

I created a pull request here: https://github.com/blei-lab/edward/pull/894

IanQS commented 6 years ago

@devinbostIL Because it still fails the tests

sadatnfs commented 6 years ago

yeah I don't think Master still has it pulled in eh

chnynf commented 6 years ago

Having the same issue. Is there a work around for now?

prithagupta commented 6 years ago

Having the same issue. Is there a work around for now?

IanQS commented 6 years ago

workaround is to use an older version of Tensorflow (Edward should work with it up to tf 1.6)

frank-y-liu commented 6 years ago

Any estimated time to get this fixed? More importantly when the fix will be released to the pip channel? I know google is releasing TF at a rapid pace. Unfortunately I can't revert back to an older version of TF simply because of Edward.

BiagioAntonelli commented 6 years ago

I'm having the same issue, any fix?

weininghu1012 commented 6 years ago

Same issue here, any possible alternative?

acanacar commented 6 years ago

having the same issue.Is there any solution?

halilbilgin commented 6 years ago

Same issue :) The only thing that works is reverting to the tensorflow==1.5.0, which is not a solution at all since I need tensorflow 1.7.0

jsevo commented 6 years ago

same issue. confirm it works fine with tensorflow==1.5.0.

unfortunately unusable atm if you need tf 1.7

hani1814 commented 6 years ago

Hi, any idea when the compatibility issue with version TF>=1.7 is going to be resolved?

Many thanks

sadatnfs commented 6 years ago

Almost certain that development on upgrading to new TF is not gonna happen any longer since Edward is now a part of TFP

denominations-io commented 5 years ago

Indeed, most of the functionality has been ported to https://www.tensorflow.org/probability/. See https://github.com/tensorflow/probability/blob/master/tensorflow_probability/python/edward2/Upgrading_From_Edward_To_Edward2.md

pranav-vempati commented 5 years ago

Having the same issue with TensorFlow 1.9.0

LZaltius commented 5 years ago

same issue with tf 1.11.0

dpmerrell commented 5 years ago

And 1.12.0 today.

It seems like newcomers should learn TensorFlow Probability/Edward2 rather than Edward 1, even though there's no mention of it on the Edward website.

janosh commented 5 years ago

It seems like newcomers should learn TensorFlow Probability/Edward2 rather than Edward 1, even though there's no mention of it on the Edward website.

This should definitely be advised on the Edward website.

fjssharpsword commented 5 years ago

My solution is : 1)find file: edward/util/random_variables.py 2)replace the import line: from tensorflow.python.framework.ops import set_shape_and_handle_data_for_outputs as set_shapes_for_outputs It works.

felipefmoreira commented 5 years ago

@fjssharpsword indeed, it worked.

jihwan-jeong commented 5 years ago

@fjssharpsword Thanks! It worked :D