sagemaker-python-sdk icon indicating copy to clipboard operation
sagemaker-python-sdk copied to clipboard

TypeError: __init__() got an unexpected keyword argument 'file'

Open BFMarks opened this issue 8 years ago • 5 comments

Hello!

Excited to try sage-maker but getting the error below after pip install sagemaker in new virtualenv. Python 2.7.10, Sierra 10.12.6. New to this product but would love to get some direction on this.

Traceback (most recent call last): File "python.py", line 29, in <module> import sagemaker File "****/lib/python2.7/site-packages/sagemaker/__init__.py", line 16, in <module> from sagemaker.amazon.kmeans import KMeans, KMeansModel, KMeansPredictor File "***/lib/python2.7/site-packages/sagemaker/amazon/kmeans.py", line 13, in <module> from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase, registry File "***/lib/python2.7/site-packages/sagemaker/amazon/amazon_estimator.py", line 19, in <module> from sagemaker.amazon.common import write_numpy_to_dense_tensor File "****/lib/python2.7/site-packages/sagemaker/amazon/common.py", line 19, in <module> from sagemaker.amazon.record_pb2 import Record File "***/lib/python2.7/site-packages/sagemaker/amazon/record_pb2.py", line 41, in <module> options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')), file=DESCRIPTOR), TypeError: __init__() got an unexpected keyword argument 'file'

Any direction welcome.

BFMarks avatar Dec 11 '17 03:12 BFMarks

Hi and thanks for trying sagemaker!

The error comes from the generated file so I suspect the issue here might be related to version differences. Specifically, the google.protobuf is a dependency of this file and looks like the version you are using has different class definition.

Could you check what version of protobuf you have installed in your virtualenv? For instance please run: pip freeze | grep proto to quickly discover that.

When I run it I see 3.5.0 and didn't hit this problem. If you can change this version in your virtualenv and try again this should go away. Please let us know if this was the case.

lukmis avatar Dec 11 '17 16:12 lukmis

That did work thanks! I have other issues now but excited to get things going.

BFMarks avatar Dec 12 '17 05:12 BFMarks

No, I am facing the issue at my Ubuntu 14.04: /object_detection/protos/string_int_label_map_pb2.py", line 41, in options=None, file=DESCRIPTOR), TypeError: new() got an unexpected keyword argument 'file' while using protoc-3.2.0. I verified my installed protobuf version with the command "pip freeze | grep proto". Any suggestion ??

arpan8514 avatar Feb 13 '18 13:02 arpan8514

Solved the issue by upgrading the TensorFlow version. :) Now, I'm using protobuf version - 3.5.1

arpan8514 avatar Feb 13 '18 14:02 arpan8514

solve the same problem by updating the protobuf version.

xiguakaoya avatar May 01 '19 13:05 xiguakaoya