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

from google.protobuf import descriptor as _descriptor ImportError: No module named google.protobuf #3086

Closed
aerointern16 opened this issue Jun 28, 2016 · 3 comments

Comments

@aerointern16
Copy link

aerointern16 commented Jun 28, 2016

Hey guys I'm working on a project using tensorflow on the Amazon Web Services microservices platform and I've run into a few problems. I installed tensorflow using pip into a virtualenv. Then I took the contents of /env/lib/python2.7/site-packages/ and zipped it along with my source code into a development package for AWS Lambda (env is the name of my virtualenv). This is the process for using python libraries for an AWS Lambda process and I haven't run into any problems with other libraries. I've done this for numpy,scipy,Pillow, and a bunch of other far less supported libraries and they have all worked fine with Lambda.

However when I attempt to use tensorflow it returns this:

Unable to import module 'classify': Traceback (most recent call last): File "/var/task/tensorflow/python/__init__.py", line 52, in from tensorflow.core.framework.graph_pb2 import * File "/var/task/tensorflow/core/framework/graph_pb2.py", line 6, in from google.protobuf import descriptor as _descriptor ImportError: No module named google.protobuf Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from its source directory; please exit the tensorflow source tree, and relaunch your python interpreter from there.

classify is the source script AWS Lambda calls when it is invoked and was zipped along with the contents of /env/lib/python2.7/site-packages/ as I described.

These errors have been addressed a couple of other places but none of the solutions I found on those pages have worked for me, probably because none of them were using lambda. Is it possible that tensorflow just will not work with lambda because of the way lambda imports libraries? If so is there anyway import the tensorflow package from just a source folder that I upload as a zip?

Specific Steps to Reproduce:

It's occurred to me that this probably isn't something tensorflow is probably supporting given that most people aren't using tensorflow inside AWS containers but hopefully someone can help or at least give it their best shot even if they don't specifically have experience with AWS.

Thanks!!

@aerointern16
Copy link
Author

aerointern16 commented Jun 28, 2016

Okay I have no idea what this does but it fixed this whole issue::

cd into site-packages
touch google/__init__.py
do this before you zip up site-packages
^bash

@martinwicke
Copy link
Member

That is fascinating. I have no idea what the problem is, but it may be endemic to AWS lambda. I'll close this issue.

@JamesBelchamber
Copy link

Stumbled over this on my travels. It's not Lambda, it's the protobuf module: protocolbuffers/protobuf#1296

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

3 participants