Reputation: 53
I'm on Ubuntu 16.04. I have: Python 2.7.12, Python 3.5.2, tensorflow 1.2.0-rc1, protobuf 3.3.0.
I want to follow this tutorial.
But I think my problem can be evidenced more succinctly with this test.py:
import tensorflow as tf
regressor = tf.contrib.learn.LinearRegressor(feature_columns=[])
I cannot instantiate regressor. I get (full Traceback at the end):
google.protobuf.text_format.ParseError: 48:12 : Message type "tensorflow.AttrValue" has no field named "5".
Same goes in [21] of the tutorial. Same goes with python2 and python3. Same goes if I use LinearClassifier instead of LinearRegressor.
Any idea about what I am doing very wrong?
Traceback (most recent call last):
File "test.py", line 2, in regressor = tf.contrib.learn.LinearRegressor(feature_columns=[])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/lazy_loader.py", line 53, in getattr module = self._load()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/lazy_loader.py", line 42, in _load module = importlib.import_module(self.name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/init.py", line 35, in from tensorflow.contrib import image
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/image/init.py", line 40, in from tensorflow.contrib.image.python.ops.single_image_random_dot_stereograms import single_image_random_dot_stereograms
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/image/python/ops/single_image_random_dot_stereograms.py", line 26, in "_single_image_random_dot_stereograms.so"))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/util/loader.py", line 55, in load_op_library ret = load_library.load_op_library(path)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/load_library.py", line 84, in load_op_library exec(wrappers, module.dict)
File "", line 248, in
File "", line 114, in _InitOpDefLibrary
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 481, in Merge descriptor_pool=descriptor_pool)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 535, in MergeLines return parser.MergeLines(lines, message)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 568, in MergeLines self._ParseOrMerge(lines, message)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 583, in _ParseOrMerge self._MergeField(tokenizer, message)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 684, in _MergeField merger(tokenizer, message, field)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 773, in _MergeMessageField self._MergeField(tokenizer, sub_message)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 684, in _MergeField merger(tokenizer, message, field)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 773, in _MergeMessageField self._MergeField(tokenizer, sub_message)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 684, in _MergeField merger(tokenizer, message, field)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 773, in _MergeMessageField self._MergeField(tokenizer, sub_message)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 652, in _MergeField (message_descriptor.full_name, name))
Upvotes: 5
Views: 3125
Reputation: 438
it's worked solution for it problem:
import _locale
_locale.setlocale(_locale.LC_NUMERIC, 'en_US.UTF-8')
python3.6, freebsd11
Upvotes: 0
Reputation: 452
Change your numeric locale settings to use a period (.) instead of a comma (,) as decimal separator.
In the Google protobuf implementation, a locale dependent function is used to convert float to strings in FloatToBuffer()
.
This becomes a problem when information from a plugin library is extracted automatically.
In your case, it is the sequence
eye_separation: float = 2.5
at offset 0xa3b4 in emphasized _single_image_random_dot_stereograms.so
After being fed to the parser which uses FloatToBuffer()
, this comes out:
attr {\n'
name: "eye_separation"\n'
type: "float"\n'
default_value {\n'
f: 2,5\n'
}\n'
}\n'
and then the tokenizer (at google/protobuf/text_format.py
) gets confused by the ,
in the default value and thinks that 5
is a separate field.
A bug report is live at GitHub and so this will hopefully get fixed, soon.
Upvotes: 3