tensorflow / tensor2tensor

Library of deep learning models and datasets designed to make deep learning more accessible and accelerate ML research.
Apache License 2.0
15.44k stars 3.49k forks source link

Installation error #1714

Open SapphireEmbers opened 5 years ago

SapphireEmbers commented 5 years ago

Description

Hi, I am having issues simply installing and running tensor2tensor. Was wondering if anyone could help me pinpoint the source of the issue.

Environment information


OS: <your answer here>
MacOS (however, ran into the same issue when running on my linux machine.)
$ pip freeze | grep tensor
# your output here
Python2: 
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
tensorboardX==1.7
Python3:
mesh-tensorflow==0.0.5
tensor2tensor==1.14.0
tensorboard==1.14.0
tensorflow==1.14.0
tensorflow-datasets==1.2.0
tensorflow-estimator==1.14.0
tensorflow-gan==1.0.0.dev0
tensorflow-metadata==0.14.0
tensorflow-probability==0.7.0

$ python -V
# your output here
Python 3.7.4 
I tested with both python3 and python2. Python2 version: Python 2.7.10

### For bugs: reproduction and error logs

# Steps to reproduce:

install tensor2tensor by running pip (or pip3) install tensor2tensor and run t2t-datagen or t2t-trainer

# Error logs:
tensorflow.python.autograph.impl.api.ConversionError: converting <function _scan_step_fn at 0x13e5f0050>: AttributeError: module 'gast' has no attribute 'Num'
jaredquincy-macbookpro:~ jaredquincy$ t2t-trainer
/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/tensor2tensor/utils/expert_utils.py:68: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 524, in to_graph
    return conversion.convert(entity, program_ctx)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/conversion.py", line 306, in convert
    entity, program_ctx, free_nonglobal_var_names)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/conversion.py", line 229, in _convert_with_cache
    entity, program_ctx)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/conversion.py", line 431, in convert_entity_to_ast
    nodes, name, entity_info = convert_func_to_ast(o, program_ctx)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/conversion.py", line 624, in convert_func_to_ast
    node = node_to_graph(node, context)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/conversion.py", line 657, in node_to_graph
    node = converter.standard_analysis(node, context, is_initial=True)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/core/converter.py", line 354, in standard_analysis
    node = qual_names.resolve(node)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/pyct/qual_names.py", line 254, in resolve
    return QnResolver().visit(node)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 262, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 317, in generic_visit
    value = self.visit(value)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 262, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 326, in generic_visit
    new_node = self.visit(old_value)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 262, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 326, in generic_visit
    new_node = self.visit(old_value)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 262, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 317, in generic_visit
    value = self.visit(value)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 262, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 317, in generic_visit
    value = self.visit(value)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 262, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 326, in generic_visit
    new_node = self.visit(old_value)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ast.py", line 262, in visit
    return visitor(node)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/pyct/qual_names.py", line 236, in visit_Subscript
    if isinstance(s.value, gast.Num):
AttributeError: module 'gast' has no attribute 'Num'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/t2t-trainer", line 23, in <module>
    from tensor2tensor.bin import t2t_trainer
  File "/usr/local/lib/python3.7/site-packages/tensor2tensor/bin/t2t_trainer.py", line 24, in <module>
    from tensor2tensor import models  # pylint: disable=unused-import
  File "/usr/local/lib/python3.7/site-packages/tensor2tensor/models/__init__.py", line 26, in <module>
    from tensor2tensor.models import basic
  File "/usr/local/lib/python3.7/site-packages/tensor2tensor/models/basic.py", line 25, in <module>
    from tensor2tensor.utils import t2t_model
  File "/usr/local/lib/python3.7/site-packages/tensor2tensor/utils/t2t_model.py", line 30, in <module>
    from tensor2tensor.data_generators import multi_problem
  File "/usr/local/lib/python3.7/site-packages/tensor2tensor/data_generators/multi_problem.py", line 22, in <module>
    from tensor2tensor.data_generators import problem
  File "/usr/local/lib/python3.7/site-packages/tensor2tensor/data_generators/problem.py", line 27, in <module>
    from tensor2tensor.data_generators import generator_utils
  File "/usr/local/lib/python3.7/site-packages/tensor2tensor/data_generators/generator_utils.py", line 1021, in <module>
    @tf.autograph.to_graph
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 600, in to_graph_v1
    experimental_optional_features=experimental_optional_features)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 528, in to_graph
    entity, e.__class__.__name__, str(e)))
tensorflow.python.autograph.impl.api.ConversionError: converting <function _scan_step_fn at 0x1414c9440>: AttributeError: module 'gast' has no attribute 'Num'
kangyongxin commented 5 years ago

我也遇到了同样的问题,请问您解决了吗?

abnf commented 5 years ago

@SapphireEmbers try pip3 install 'gast==0.2.2' see https://github.com/tensorflow/tensorflow/issues/32319

mihaimaruseac commented 5 years ago

For 1.14 you have to manually install gast==0.2.2; For 1.15 and later, it has been already pinned.