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

Protobuf 3.6.1 import issue with tensorflow 1.10 #21719

Closed
nirajkale opened this issue Aug 19, 2018 · 18 comments
Closed

Protobuf 3.6.1 import issue with tensorflow 1.10 #21719

nirajkale opened this issue Aug 19, 2018 · 18 comments
Assignees

Comments

@nirajkale
Copy link

Version: master/v3.6.1
Language: Python 3.6x64 on Windows 10

Steps to reproduce the behavior:
**Followed instructions mentioned on tensorflow.org's guide on installing tensorflow on Windows
(www.tensorflow.org/install/install_windows)

  1. Installed CUDA 9.0 (latest release supported by tf_gpu)
  2. Installed cuDNN v7 for (CUDA 9.0)
  3. Installed tensorflow_gpu using native-pip
    **protobuf is part of tf gpu installation
  4. After the installation, i wanted to test the tf, so as usual tried:
    import tensorflow
    but got an error:==>
    Traceback (most recent call last):
    File "<pyshell#0>", line 1, in
    import tensorflow
    File "C:\Users\Niraj\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_init_.py", line 22, in
    from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
    File "C:\Users\Niraj\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python_init_.py", line 52, in
    from tensorflow.core.framework.graph_pb2 import *
    File "C:\Users\Niraj\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in
    from google.protobuf import descriptor as _descriptor
    File "C:\Users\Niraj\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\descriptor.py", line 47, in
    from google.protobuf.pyext import _message
    ImportError: DLL load failed: The specified procedure could not be found.

Initially i thought the issue was related to CUDA or cdnn itself, but after hours of trial & error with multiple cuda & cudnn version combination, i decided to focus on the library mentioned in the error message itself.
I'm not very new to python extensions so obvious work around for me was to try earlier version of protobuf, so i tried:

pip uninstall protobuf
pip install protobuf==3.6.0

and tada!! tensorflow started working.
I'm still not sure if this was actually caused by protobuf or incorrect installations etc.
My sincere apologies if this issue is unrelated.
Please let me know if you need more details on this issue.

@tensorflowbutler tensorflowbutler added the stat:awaiting response Status - Awaiting response from author label Aug 20, 2018
@tensorflowbutler
Copy link
Member

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
Have I written custom code
OS Platform and Distribution
TensorFlow installed from
TensorFlow version
Bazel version
CUDA/cuDNN version
GPU model and memory
Exact command to reproduce
Mobile device

@nirajkale
Copy link
Author

Hi,
Pfb more details:
Have I written custom code : n/a
OS Platform and Distribution: Windows 10
TensorFlow installed from: python native pip without​ Anaconda
TensorFlow version: 1.10
Bazel version: n/a
CUDA/cuDNN version: Cuda: 9.0, cuDNN v7.05
GPU model and memory: GTX1060 6gb
Exact command to reproduce: just tried to import tensorflow after pip installation
Mobile device: n/a

I was able to fix the issue after downgrading protobuf from 3.6.1 to 3.6.0
Hope this helps!

@gunan
Copy link
Contributor

gunan commented Aug 20, 2018

Hi,
I have a few questions. What do you mean by:

Installed tensorflow_gpu using native-pip
**protobuf is part of tf gpu installation

Also, did you upgrade your tensorflow installation from a previous version, or did you install tf from scratch on your machine?

@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Aug 21, 2018
@shunluzhang
Copy link

Same here, exactly same problem after upgrading to tensorflow 1.10, also tried clean install tensorflow 1.10.

protobuf 3.6.1 doesn't not work for CPU and GPU, but protobuf 3.6.0 works for both.

@nirajkale
Copy link
Author

**protobuf is part of tf gpu installation - meaning protobuf was installed as part of pip installation of tensorflow.
Also, i did the installation from scratch.

@pjm4github
Copy link

What a nightmare getting this to work on Windows 10!
I had to do this:

  1. Install Python3.6 (downgraded from 3.7)
  2. Install and create a virtualenv
    pip3 install virtualenv
    virtualenv venv
  3. Activate the virtualenv
    ./venv/Scripts/activate
    Now comes the guessing game to figure out which version of protobuf plays nicely with which version of tensorflow
    In the end I matched up tensorflow==1.5.0 and protobuf==3.4.0
  4. Install protobuf
    pip3 install protobuf==3.4.0
  5. Install tensorflow
    pip3 install tensorflow==1.5.0

Now I can test it:
(venv) $ python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf

@emartorano
Copy link

I had exactly the same issue. I spend the entire day trying to figure out what was wrong. I installed and uninstalled python, tf, etc.. million times on my new Windows 10 machine. This morning I saw this post. I deleted protobuf 3.6.1 and installed 3.6.0. Bingo ! everything is working. Thanks a lot

@gunan
Copy link
Contributor

gunan commented Aug 31, 2018

@acozzette @xfxyjwf
Is there a known backwards compatibility issue between protobuf 3.6.1 and 3.6.0?

@acozzette
Copy link
Contributor

@gunan No, I don't know of any backward compatibility issues between 3.6.0 and 3.6.1. @anandolee Do you have any ideas what it could be?

@xfxyjwf
Copy link

xfxyjwf commented Sep 1, 2018

This is protocolbuffers/protobuf#5046 . @TeBoring what's the solution to this issue?

@TeBoring
Copy link

TeBoring commented Sep 1, 2018 via email

@tensorflowbutler
Copy link
Member

Nagging Assignees @gunan, @poxvoculi: It has been 29 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

@gunan
Copy link
Contributor

gunan commented Sep 30, 2018

Looking at the comments, this actually looks like a missing backwards compatibility issue in protobuf between 3.6.0 and 3.6.1
Unfortunately, solution is to upgrade protobuf to 3.6.1.
I will make that change in our setup.py script, and close this issue.

@MalleSrikanth
Copy link

DLL LOAD ERROR SPECIFIED ERROR COUDN'T FOUND
WINDOWS 7 INSTALLED TENSORFLOW 1.12 WITH CUDNN 9 THROUGH ANACONDA PYTHON VERSION 3.6.7

(SRI) C:\Users\SRIKANTH>python -c "import tensorflow"
Traceback (most recent call last):
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow\python
\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript
ion)
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\imp.py", line 243, in load_modu
le
return load_dynamic(name, filename, file)
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\imp.py", line 343, in load_dyna
mic
return _load(spec)
ImportError: DLL load failed: The specified procedure could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow__init
_.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-im
port
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow\python
_init
.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow\python
\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow\python
\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript
ion)
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\imp.py", line 243, in load_modu
le
return load_dynamic(name, filename, file)
File "C:\Users\SRIKANTH\Anaconda3\envs\SRI\lib\imp.py", line 343, in load_dyna
mic
return _load(spec)
ImportError: DLL load failed: The specified procedure could not be found.

Failed to load the native TensorFlow runtimE

@nirajkale
Copy link
Author

To add an update, this issue is not only related to tf-gpu version but also occurs for cpu version if installed with python version 3.6.0
this can still be solved by replacing default protobuf version with 3.6.0

@NeelKanwal
Copy link

I have installed tensorflow==1.5.0 and protobuf==3.6.0 and 3.4.0 alternatively but there is still an issues.

/home/nkanwal/bert/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:496: 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)])
/home/nkanwal/bert/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:497: 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)])
/home/nkanwal/bert/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:502: 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)])

please suggest some solution

@nirajkale
Copy link
Author

I have installed tensorflow==1.5.0 and protobuf==3.6.0 and 3.4.0 alternatively but there is still an issues.

/home/nkanwal/bert/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:496: 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)])
/home/nkanwal/bert/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:497: 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)])
/home/nkanwal/bert/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:502: 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)])

please suggest some solution

I din know the older versions of tensorflow were still being used. Anyway, i would suggest keeping only one version of protobuff. I think tf might be using the higher version which might be causing the issue.
Not sure which exact version of protobuf will work with tf 1.5. U might have to do some trial n error but while doing so, pls try one at a time ( as in 1 version in ur virtual env at a time)
Hope this help!

@shubhambagwari
Copy link

File "stylize.py", line 97, in
main()
File "stylize.py", line 57, in main
graph_def.ParseFromString(f.read())
File "C:\Users\shubham\myenv\lib\site-packages\google\protobuf\message.py", line 185, in ParseFromString
self.MergeFromString(serialized)
File "C:\Users\shubham\myenv\lib\site-packages\google\protobuf\internal\python_message.py", line 1083, in MergeFromString
if self._InternalParse(serialized, 0, length) != length:
File "C:\Users\shubham\myenv\lib\site-packages\google\protobuf\internal\python_message.py", line 1109, in InternalParse
new_pos = local_SkipField(buffer, new_pos, end, tag_bytes)
File "C:\Users\shubham\myenv\lib\site-packages\google\protobuf\internal\decoder.py", line 850, in SkipField
return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end)
File "C:\Users\shubham\myenv\lib\site-packages\google\protobuf\internal\decoder.py", line 820, in _RaiseInvalidWireType
raise _DecodeError('Tag had invalid wire type.')
google.protobuf.message.DecodeError: Tag had invalid wire type.

After reading everything, Still, I am getting this error.

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