[ 
https://issues.apache.org/jira/browse/SINGA-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16696497#comment-16696497
 ] 

ASF subversion and git services commented on SINGA-396:
-------------------------------------------------------

Commit 99bae0209631fd3bf37de1a84d8e2ea396d1dddf in incubator-singa's branch 
refs/heads/master from Wang Wei
[ https://git-wip-us.apache.org/repos/asf?p=incubator-singa.git;h=99bae02 ]

SINGA-409 [Singa 1.2.0] Basic `singa-cpu` import throws error

It is due to the version mismatch of Protobuf.
In SINGA-396, we updated the protobuf version to be >=3.2.0. And the
singa package is built using 3.2.0.
However, 3.6.1 is installed in your OS. In other words, the runtime env
and the building env mismatch.
In this commit, we fix the version for both building and runtime to
3.6.1.


> Upgrade `protobuf` to 3.6.1 to match Tensorflow's
> -------------------------------------------------
>
>                 Key: SINGA-396
>                 URL: https://issues.apache.org/jira/browse/SINGA-396
>             Project: Singa
>          Issue Type: Improvement
>          Components: PySINGA
>            Reporter: Ngin Yun Chuan
>            Priority: Minor
>
> `singa-cpu==1.1.1` depends on `protobuf==3.2.0`, but `tensorflow==1.10.1` 
> depends on `protobuf==3.6.1`. When Tensorflow is installed with Singa on the 
> same image, such an error occurs when importing `tensorflow`:
> ```
> ...
>   File 
> "/usr/local/envs/rafiki/lib/python3.6/site-packages/tensorflow/__init__.py", 
> line 22, in <module>
>     from tensorflow.python import pywrap_tensorflow  # pylint: 
> disable=unused-import
>   File 
> "/usr/local/envs/rafiki/lib/python3.6/site-packages/tensorflow/python/__init__.py",
>  line 52, in <module>
>     from tensorflow.core.framework.graph_pb2 import *
>   File 
> "/usr/local/envs/rafiki/lib/python3.6/site-packages/tensorflow/core/framework/graph_pb2.py",
>  line 15, in <module>
>     from tensorflow.core.framework import node_def_pb2 as 
> tensorflow_dot_core_dot_framework_dot_node__def__pb2
>   File 
> "/usr/local/envs/rafiki/lib/python3.6/site-packages/tensorflow/core/framework/node_def_pb2.py",
>  line 15, in <module>
>     from tensorflow.core.framework import attr_value_pb2 as 
> tensorflow_dot_core_dot_framework_dot_attr__value__pb2
>   File 
> "/usr/local/envs/rafiki/lib/python3.6/site-packages/tensorflow/core/framework/attr_value_pb2.py",
>  line 15, in <module>
>     from tensorflow.core.framework import tensor_pb2 as 
> tensorflow_dot_core_dot_framework_dot_tensor__pb2
>   File 
> "/usr/local/envs/rafiki/lib/python3.6/site-packages/tensorflow/core/framework/tensor_pb2.py",
>  line 15, in <module>
>     from tensorflow.core.framework import resource_handle_pb2 as 
> tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
>   File 
> "/usr/local/envs/rafiki/lib/python3.6/site-packages/tensorflow/core/framework/resource_handle_pb2.py",
>  line 22, in <module>
>     
> serialized_pb=_b('\n/tensorflow/core/framework/resource_handle.proto\x12\ntensorflow\"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01
>  \x01(\t\x12\x11\n\tcontainer\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 
> \x01(\t\x12\x11\n\thash_code\x18\x04 
> \x01(\x04\x12\x17\n\x0fmaybe_type_name\x18\x05 
> \x01(\tBn\n\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01Z=github.com/tensorflow/tensorflow/tensorflow/go/core/framework\xf8\x01\x01\x62\x06proto3')
> TypeError: __new__() got an unexpected keyword argument 'serialized_options'
> ```
> This error seems to occur due to an incompatible version of `protobuf`: 
> [https://stackoverflow.com/questions/49463060/python-tensorflow-import-failed]
> Here is a Dockerfile that reproduces the error:
> ```
> FROM ubuntu:16.04
> RUN apt-get update && apt-get -y upgrade
> # Install conda with pip and python 3.6
> RUN apt-get -y install curl bzip2 \
>     && curl -sSL 
> https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o 
> /tmp/miniconda.sh \
>     && bash /tmp/miniconda.sh -bfp /usr/local \
>     && rm -rf /tmp/miniconda.sh \
>     && conda create -y --name rafiki python=3.6 \
>     && conda clean --all --yes
> ENV PATH /usr/local/envs/rafiki/bin:$PATH
> RUN pip install tensorflow==1.10.1
> RUN conda install --name rafiki -y -c nusdbsystem singa-cpu==1.1.1
> CMD python -c 'import tensorflow'
> ```
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to