Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtualenv python 2.7.6 import tensorflow. TypeError: __init__() got an unexpected keyword argument 'syntax' #57

Closed
liuyipei opened this issue Nov 10, 2015 · 4 comments

Comments

@liuyipei
Copy link
Contributor

I am running inside a virtual env and followed the given instructions. The following problem is consistent whether I compile from scratch or use the whl from the provided Internet link.

Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/4tb_internal/python/tensorflow/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
    from tensorflow.python import *
  File "/mnt/4tb_internal/python/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 13, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "/mnt/4tb_internal/python/tensorflow/local/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "/mnt/4tb_internal/python/tensorflow/local/lib/python2.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "/mnt/4tb_internal/python/tensorflow/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
  File "/mnt/4tb_internal/python/tensorflow/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
    serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"d\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
>>> 

Here is the output to pip show numpy protobuf

Name: numpy
Version: 1.10.1
Location: /mnt/4tb_internal/python/tensorflow/lib/python2.7/site-packages
Requires: 

Name: protobuf
Version: 3.0.0a3
Location: /mnt/4tb_internal/python/tensorflow/lib/python2.7/site-packages
Requires: setuptools

Here is the output to uname -a. My machine runs Ubuntu 14.04 LTS.

Linux yi-2014 3.13.0-64-generic #104-Ubuntu SMP Wed Sep 9 12:36:12 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
@vrv
Copy link

vrv commented Nov 10, 2015

Likely a dupe of #11 -- see the solutions near the very end to see if they help. Thanks!

@vrv vrv closed this as completed Nov 10, 2015
@vrv vrv reopened this Nov 10, 2015
@liuyipei
Copy link
Contributor Author

I removed libprotoc and followed instructions from https://github.com/google/protobuf and installed the new beta version of protoc 3.0.

Here is the output to protoc --version

(tensorflow)yiliu@yi-2014:~$ protoc --version
libprotoc 3.0.0

I then reinstalled tensorflow, but the output persists.

@vrv
Copy link

vrv commented Nov 10, 2015

It's probably something to do with the path -- can you verify that there are no other protobuf libraries on your system that might be interfering? This problem only occurs when it's using the proto2 version of the python libraries: our python generated files use python3.

To help debug, maybe also try to print the version of the protobuf library when in python?

import google.protobuf
print google.protobuf.__version__

or something like that?

@liuyipei
Copy link
Contributor Author

Thank you for your help.
google.protobuf.__version__ was not defined, thereby confirming your suspicion about paths.

To fix my issue:
I exited the tensorflow virtualenv and returned to my default env. Then, I did sudo pip uninstall protobuf.

ilblackdragon added a commit to ilblackdragon/tensorflow that referenced this issue Mar 9, 2016
…entropy. The math should work as -weight[class]*x[class] + log( sum ( exp weighted x))
ilblackdragon added a commit to ilblackdragon/tensorflow that referenced this issue Mar 9, 2016
…Now just pass an array of n_classes with weights and it will adjust logits and loss value for this
benoitsteiner pushed a commit that referenced this issue May 31, 2017
* OpenCL Improvements

* Registers Scatter and ScatterNd Ops for SYCL

* Registers Stack op for SYCL

* Fixes No sycl buffer found error for debug ops

* Registers MatMul and Transpose Ops to SYCL device for double

* Extends analyzer_cli_test.py test to cover SYCL

* Fixes Transpose Op for double when on SYCL

* Bumps Eigen version to fix double precision issue on SYCL

* Extends SessionDebugTestBase to cover SYCL

* Register SYCL implementations for random ops

* Avoid functions that might not be defined on SYCL device (#51)

* Avoid functions that might not be defined on SYCL device

* Simplify by using Eigen math functions

* OpenCL improvements

 - Bumps Eigen Version
 - Refactors Ops registration
 - Introduces workaround for Const Op related to the difference between
   CUDA which uses pointers and OpenCL that uses buffers/accessors
 - Extends memory types to cover DEVICE_SYCL as well
 - Introduces  GetSYCLDevice() method that returns list of supported devices
   with GPU device having the highest priority ( doesn't include blacklisted devices )
 - ::internal::Transpose -> tensorflow::internal::Transpose in order to
   avoid compilation reported error
 - re-introduces fix for bugged string replacement causing a lot of compilation
   warnings -c -> --include
 - Adds sycl_runtime to bazels ARRAY_DEPS
 - Replicates TF_CALL_GPU_PROXY_TYPES for SYCL

* [OpenCL] Fixes an issue caused by switch to aligned allocator for sycl buffer (#53)

* [Build] Use gcc/g++ as a host compiler to avoid #8394 (#54)

* [OpenCL] Fixes Scatter Op

* Fix testSimple and testConst in stack_op_test (#3)

* Fix testSimple and testConst in stack_op_test

* Create a specialisation of DoParallelConcatUpdate for SyclDevice and
register it

* Guard all code in TENSORFLOW_USE_SYCL

* Do not use sycl device for int32

* Registration of the Sycl version is now looking like the one for the GPU

* Remove added empty line

* Register batch normalization kernels for OpenCL (#61)

* [OpenCL] RandomGamma has no GPU friendly implementation (#57)

* [OpenCL] Compatibility fixes for TensorFlow 1.1.0-rc1

* [OpenCL] Implements BatchMatmul Op for SYCL

* Lowercase the device name when GPU or SYCL returned

* [OpenCL] kernel_estimator_test.py assertEqual-> assertAlmostEqual due to floating point representation on the device

* [Eigen] Version bump

* GPU device name string manipulation is not needed anymore

* [OpenCL] Adds SYCL to device backwards compatibility

* [OpenCL] Extends core_rnn_test.py to run for SYCL device

* [OpenCL] Minor optimizations for build script

* [OpenCL] Enables skip folder list in build script

* [OpenCL] Fixes ApplyAdamOp for Sycl device

* [OpenCL] SYCL device improvements

* [OpenCL] Fixes debug_ops's SEGFAULT for SYCL device

* [Build] Adds hexagon to skipped folders list

* [OpenCL] Removes EnterLameDuckMode from SYCL device and allocator

* [OpenCL] Registers Unique Op for SYCL device

* [OpenCL][Temporary] Disables tests for SYCL target due to features not being implemented yet

  Tests affected:
    - tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py
    - tensorflow/contrib/rnn/python/kernel_tests/core_rnn_test.py
    - tensorflow/python/kernel_tests/conv_ops_test.py
    - tensorflow/python/kernel_tests/depthwise_conv_op_test.py
    - tensorflow/python/kernel_tests/pooling_ops_3d_test.py
    - tensorflow/python/kernel_tests/pooling_ops_test.py
    - tensorflow/python/kernel_tests/scatter_nd_ops_test.py
    - tensorflow/python/training/adam_test.py
    - tensorflow/python/training/localhost_cluster_performance_test.py
    - tensorflow/python/training/training_ops_test.py

* [OpenCL][Temporary] Disables failing tests for SYCL in order to establish regression baseline

  Tests affected:
    - tensorflow/python/debug/cli/analyzer_cli_test.py
    - tensorflow/python/debug/lib/session_debug_testlib.py
    - tensorflow/python/debug/lib/stepper_test.py
    - tensorflow/python/kernel_tests/unstack_op_test.py
    - tensorflow/python/ops/image_ops_test.py

* [OpenCL] Take options.config.device_count() into consideration

* [OpenCL] Fixes compilation warning

* [OpenCL] device:SYCL:0 -> sycl:0

* [OpenCL] Removes unwanted flags in building script

Removes flags given to computecpp that enable SIMD instructions
Removes duplicate flags

* bool -> const bool

* [OpenCL] sycl in test_util.gpu_device_name() -> is_sycl_enabled()

* [OpenCL][Temporary] Disables failing tests for SYCL in order to establish regression baseline

  Test affected:
    - tensorflow/contrib/stateless/python/kernel_tests/stateless_random_ops_test.py

* Imports test_util from tensorflow.python.framework

* [OpenCL] Fixes formatting in Python code

* [OpenCL] Extends session_test.py to cover SYCL device

* [OpenCL] Cleans singleton class

* [OpenCL] Keeping CUDA happy

* [OpenCL][Temporary] Disables failing tests for SYCL in order to establish regression baseline

  Test affected:
   - tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py
   - tensorflow/contrib/seq2seq/python/kernel_tests/beam_search_ops_test.py

* Added support for building with SYCL on ARM.

* Acts on the review feedback from:
 - #9117 (comment)
 - #9117 (comment)

* [OpenCL] Fixes scatter_nd_op_test

* Fixes auto-merge mistake

* [OpenCL] struct SyclDevice -> class SyclDevice

* Revert "[OpenCL] struct SyclDevice -> class SyclDevice"

This reverts commit addd433.

* [OpenCL] Reverting refactoring commit.

  As requested in the review #9117 (comment)
  This change set will be re-introduced in smaller chunks.

* Revert "[OpenCL] device:SYCL:0 -> sycl:0"

This reverts commit cf16e60.

* Revert "[OpenCL] Adds SYCL to device backwards compatibility"

This reverts commit b8401b5.

* Acts on the feedback from #9117 (comment)

* control_flow_ops_py_test.py expects device name to be lower cased

* Acts on the feedback from #9117 (comment)

* Removes debug print

* Removes not needed partial specialisation

* [OpenCL] Registers ScatterNdFunctor for SYCL device

* [OpenCL] Make it compile

* [OpenCL] Follow gpu_device changes

* [OpenCL] Adds cxx_builtin_include_directory for python lib

  Fixes bazels missing undeclared inclusions that appeared after
  merge with TensorFlow upstream

* [OpenCL] Fixes Constant Op

* [OpenCL] gXX-4.8 -> gXX

* [OpenCL] Removes -D_GLIBCXX_USE_CXX11_ABI=0 as it breaks default compiler setup for Ubuntu 16.04

* Revert "[OpenCL] kernel_estimator_test.py assertEqual-> assertAlmostEqual due to floating point representation on the device"

This reverts commit 06c50c0.

* [OpenCL] CPU allocator is a singleton we should not delete it
tarasglek pushed a commit to tarasglek/tensorflow that referenced this issue Jun 20, 2017
* Modified the way the output size is specified.
* Added support for batches of inputs.
tarasglek pushed a commit to tarasglek/tensorflow that referenced this issue Jun 20, 2017
…put size (tensorflow#155)

* Changed the examples to specify the output size instead of the downsample_factor.

This is required by PR tensorflow#57

* Address flake8 errors.

* Update readme and parameter descriptions.
lukeiwanski pushed a commit to codeplaysoftware/tensorflow that referenced this issue Oct 26, 2017
* [OpenCL] Create all SYCL FillPhiloxRandom functors

Adds the two distributions currently not being instantiated in the SYCL
kernel registration. These are needed for StatelessRandomOps.

* [OpenCL] Registers SYCL StatelessRandomOps

Provides SYCL device kernels for the StatelessRandomOps.
lissyx added a commit to lissyx/tensorflow that referenced this issue Feb 20, 2018
copybara-service bot pushed a commit that referenced this issue Mar 3, 2023
…be the last of the fallout from the refactoring.

Should fix #57.

PiperOrigin-RevId: 513863434
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants