Probability: Importing tensorflow probability is raising AttributeError: module 'gast' has no attribute 'Ellipsis' in tensorflow

Created on 9 Sep 2019  Â·  8Comments  Â·  Source: tensorflow/probability

Importing tfp with new nightlies is raising an exception

Package Versions

tf-nightly-2-0-preview 2.0.0.dev20190908 pypi_0 pypi
tfp-nightly 0.9.0.dev20190908 pypi_0 pypi

Stack Trace

In [4]: import tensorflow_probability as tfp                                                                                                                                 
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-41494c8c96ff> in <module>
----> 1 import tensorflow_probability as tfp

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/__init__.py in <module>
     73 
     74 # from tensorflow_probability.google import staging  # DisableOnExport
---> 75 from tensorflow_probability.python import *  # pylint: disable=wildcard-import
     76 from tensorflow_probability.python.version import __version__
     77 # pylint: enable=g-import-not-at-top

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/__init__.py in <module>
     22 from tensorflow_probability.python import debugging
     23 from tensorflow_probability.python import distributions
---> 24 from tensorflow_probability.python import edward2
     25 from tensorflow_probability.python import experimental
     26 from tensorflow_probability.python import glm

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/edward2/__init__.py in <module>
     30 
     31 # pylint: disable=wildcard-import
---> 32 from tensorflow_probability.python.experimental.edward2.generated_random_variables import *
     33 from tensorflow_probability.python.experimental.edward2.generated_random_variables import as_random_variable
     34 from tensorflow_probability.python.experimental.edward2.generated_random_variables import rv_dict

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/experimental/__init__.py in <module>
     32 from __future__ import print_function
     33 
---> 34 from tensorflow_probability.python.experimental import auto_batching
     35 from tensorflow_probability.python.experimental import edward2
     36 from tensorflow_probability.python.experimental import mcmc

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/experimental/auto_batching/__init__.py in <module>
     22 from tensorflow_probability.python.experimental.auto_batching import allocation_strategy
     23 from tensorflow_probability.python.experimental.auto_batching import dsl
---> 24 from tensorflow_probability.python.experimental.auto_batching import frontend
     25 from tensorflow_probability.python.experimental.auto_batching import instructions
     26 from tensorflow_probability.python.experimental.auto_batching import liveness

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/experimental/auto_batching/frontend.py in <module>
     50 from tensorflow.python.autograph.pyct import templates
     51 from tensorflow.python.autograph.pyct import transformer
---> 52 from tensorflow.python.autograph.pyct.common_transformers import anf
     53 
     54 TF_BACKEND = tf_backend.TensorFlowBackend()

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/common_transformers/anf.py in <module>
     86 
     87 
---> 88 class AnfTransformer(transformer.Base):
     89   """Performs the conversion to A-normal form (ANF)."""
     90 

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/common_transformers/anf.py in AnfTransformer()
    150       gast.Is, gast.IsNot, gast.In, gast.NotIn,
    151       # Other leaf nodes that don't make sense standalone.
--> 152       gast.expr_context, gast.Ellipsis,
    153   )
    154 

AttributeError: module 'gast' has no attribute 'Ellipsis'

Most helpful comment

gast==0.3.0 doesn't fix this for me, but gast==0.2.2 does.

All 8 comments

Yes it looks like 3.8 changes ast.Ellipsis to ast.Constant with node.value is Ellipsis.

On Sun, Sep 8, 2019, 9:04 PM Ravin Kumar notifications@github.com wrote:

Importing tfp with new nightlies is raising an exception

Package Versions

tf-nightly-2-0-preview 2.0.0.dev20190908 pypi_0 pypi
tfp-nightly 0.9.0.dev20190908 pypi_0 pypi

Stack Trace

In [4]: import tensorflow_probability as tfp

AttributeError Traceback (most recent call last)
in
----> 1 import tensorflow_probability as tfp

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/__init__.py in
73
74 # from tensorflow_probability.google import staging # DisableOnExport
---> 75 from tensorflow_probability.python import * # pylint: disable=wildcard-import
76 from tensorflow_probability.python.version import __version__
77 # pylint: enable=g-import-not-at-top

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/__init__.py in
22 from tensorflow_probability.python import debugging
23 from tensorflow_probability.python import distributions
---> 24 from tensorflow_probability.python import edward2
25 from tensorflow_probability.python import experimental
26 from tensorflow_probability.python import glm

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/edward2/__init__.py in
30
31 # pylint: disable=wildcard-import
---> 32 from tensorflow_probability.python.experimental.edward2.generated_random_variables import *
33 from tensorflow_probability.python.experimental.edward2.generated_random_variables import as_random_variable
34 from tensorflow_probability.python.experimental.edward2.generated_random_variables import rv_dict

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/experimental/__init__.py in
32 from __future__ import print_function
33
---> 34 from tensorflow_probability.python.experimental import auto_batching
35 from tensorflow_probability.python.experimental import edward2
36 from tensorflow_probability.python.experimental import mcmc

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/experimental/auto_batching/__init__.py in
22 from tensorflow_probability.python.experimental.auto_batching import allocation_strategy
23 from tensorflow_probability.python.experimental.auto_batching import dsl
---> 24 from tensorflow_probability.python.experimental.auto_batching import frontend
25 from tensorflow_probability.python.experimental.auto_batching import instructions
26 from tensorflow_probability.python.experimental.auto_batching import liveness

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_probability/python/experimental/auto_batching/frontend.py in
50 from tensorflow.python.autograph.pyct import templates
51 from tensorflow.python.autograph.pyct import transformer
---> 52 from tensorflow.python.autograph.pyct.common_transformers import anf
53
54 TF_BACKEND = tf_backend.TensorFlowBackend()

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/common_transformers/anf.py in
86
87
---> 88 class AnfTransformer(transformer.Base):
89 """Performs the conversion to A-normal form (ANF)."""
90

~/miniconda3/envs/pymc4/lib/python3.6/site-packages/tensorflow_core/python/autograph/pyct/common_transformers/anf.py in AnfTransformer()
150 gast.Is, gast.IsNot, gast.In, gast.NotIn,
151 # Other leaf nodes that don't make sense standalone.
--> 152 gast.expr_context, gast.Ellipsis,
153 )
154

AttributeError: module 'gast' has no attribute 'Ellipsis'

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/probability/issues/552?email_source=notifications&email_token=AFJFSI552DDMINDHO3Q3VX3QIWOI3A5CNFSM4IUVRDPKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKBQ2IA,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFJFSI6G3KKYPBKM62PBYEDQIWOI3ANCNFSM4IUVRDPA
.

I got the same error message.

Additionally, now I'm using

tensorflow-gpu==2.0.0-rc0
tensorflow-probability==0.8.0rc0

Try setting the version for gast==0.3.0

https://pypi.org/project/gast/#history

On Mon, Sep 9, 2019, 6:59 AM Jaewoo Ahn notifications@github.com wrote:

I got the same error message.

Additionally, now I'm using

tensorflow-gpu==2.0.0-rc0
tensorflow-probability==0.8.0rc0

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/probability/issues/552?email_source=notifications&email_token=AFJFSI2FG3MRWRNMEISFSP3QIYUBBA5CNFSM4IUVRDPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HEH6Q#issuecomment-529417210,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFJFSIYYBGZPHKCLWRLQMXTQIYUBBANCNFSM4IUVRDPA
.

gast==0.3.0 doesn't fix this for me, but gast==0.2.2 does.

@brianwa84 , gast==0.3.0 doesn't work, with 0.2.2 the TFP import works fine.

I'm still running into this issue with the latest nightly (tfp-nightly-0.9.0.dev20191008) which installs gast-0.3.2 for me in a clean environment.

tfp nightly works against tf nightly. Which version of TF are you using?

Brian Patton | Software Engineer | [email protected]

On Tue, Oct 8, 2019 at 7:03 AM Janosh Riebesell notifications@github.com
wrote:

I'm still running into this issue with the latest nightly (
tfp-nightly-0.9.0.dev20191008) which installs gast-0.3.2 for me in a
clean environment.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/tensorflow/probability/issues/552?email_source=notifications&email_token=AFJFSI7SD2TGWUCMQ2RMWCLQNRSH5A5CNFSM4IUVRDPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEATYZXA#issuecomment-539462876,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFJFSI5RIGQFG6WZX6AZSCLQNRSH5ANCNFSM4IUVRDPA
.

Ah, sorry for the noise. I was still using tf-nightly-2.0-preview. Installing tf-nightly==2.1.0.dev20191008 solved the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fdtomasi picture fdtomasi  Â·  4Comments

junpenglao picture junpenglao  Â·  6Comments

AliKhoda picture AliKhoda  Â·  5Comments

ankur-manikandan picture ankur-manikandan  Â·  6Comments

Hoeze picture Hoeze  Â·  3Comments