# ModuleNotFoundError: No module named 'google'

**URL:** <https://discuss.dgraph.io/t/modulenotfounderror-no-module-named-google/8229>\
**Category:** Dgraph Clients\
**Tags:** untagged, pydgraph\
**Created:** [September 6, 2019, 1:30pm UTC](https://discuss.dgraph.io/t/modulenotfounderror-no-module-named-google/8229 "2019-09-06T13:30:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [September 6, 2019, 1:30pm UTC](https://discuss.dgraph.io/t/modulenotfounderror-no-module-named-google/8229/1 "2019-09-06T13:30:18Z")

</div>

**Moved from GitHub [pydgraph/80](https://github.com/dgraph-io/pydgraph/issues/80)**

_Posted by_ [Tails](https://github.com/Tails):

I’m having trouble installing pydgraph using pip, while this used to work before 2.0.0 (downgrading using `pydgraph==1.2.0` does work).

 ![image](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/0/0371dd7650cf76614c593676a5dd1fbc064d9e8e.png)

**Stack trace**

```tty
Collecting pydgraph (from -r /runtime/app/requirements.txt (line 40))
  Downloading https://files.pythonhosted.org/packages/4d/19/025436211062e121cc344d2f34ed40e990a12a6437d3478161552bf08451/pydgraph-2.0.0.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fejh1_9l/pydgraph/setup.py'"'"'; __file__ ='"'"'/tmp/pip-install-fejh1_9l/pydgraph/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)( __file__ );code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__ , '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /tmp/pip-install-fejh1_9l/pydgraph/
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-fejh1_9l/pydgraph/setup.py", line 33, in <module>
        from pydgraph.meta import VERSION
      File "/tmp/pip-install-fejh1_9l/pydgraph/pydgraph/ __init__.py", line 15, in <module>
        from pydgraph.proto.api_pb2 import Operation, Payload, Request, Response, Mutation, TxnContext,\
      File "/tmp/pip-install-fejh1_9l/pydgraph/pydgraph/proto/api_pb2.py", line 7, in <module>
        from google.protobuf import descriptor as _descriptor
    ModuleNotFoundError: No module named 'google'

```

Trying to install the `protobuf` or `google` packages before dgraph (as advised on StackOverflow) doesn’t make a difference.

**Dockerfile**

```Dockerfile
# https://github.com/aciobanu/docker-scrapy
FROM python:3.7.0-alpine3.8

WORKDIR /runtime/app

# https://unix.stackexchange.com/a/417661/299202
RUN apk add --update --no-cache openssh sshpass

RUN apk -U add \
        gcc \
        g++ \
        git \
        bash \
        libffi-dev \
        libxml2-dev \
        libxslt-dev \
        libjpeg \
        jpeg-dev \
        musl-dev \
        #openssl-dev \
        python-dev \
        python3-dev \
        py-imaging \
        py3-pillow \
        py3-lxml \
        libxml2-utils \
        linux-headers \
        py-pip \
        make \
        db-dev \
        #mariadb-dev \
        mysql-dev \
        curl \
        ca-certificates \
        rsync \
        tidyhtml \
        tidyhtml-libs \
        tidyhtml-dev \
    && update-ca-certificates \
    && rm -rf /var/cache/apk/*

# TODO: automate this away by using the python-alpine-small image with onbuild
ADD ./requirements.txt /runtime/app/requirements.txt

RUN pip3 install --upgrade pip

# https://github.com/grpc/grpc/issues/17711
RUN pip3 install cython

RUN pip3 install -r /runtime/app/requirements.txt #--target=/runtime/app/.packages

```

**requirements.txt**

```auto
google-cloud #even these packages do not fix missing google module
#google
grpcio
grpcio-tools
protobuf
pydgraph

```

Related:

> <https://github.com/protocolbuffers/protobuf/issues/6135>
>
> Language: Python
> protobuf: 3.7.1
> 
> \*\*What operating system (Linux, Windows, ..….) and version?\*\*
> Windows 10
> 
> \*\*What runtime / compiler are you using (e.g., python version or gcc version)\*\*
> Python 3.6.5
> 
> \*\*What did you do?\*\*
> 
> I am coding a game and on running it I am getting-
> \`Traceback (most recent call last):
> File "\<frozen importlib.\_bootstrap\>", line 968, in \_find\_and\_load
> SystemError: \<class '\_frozen\_importlib.\_ModuleLockManager'\> returned a result with an error set
> ImportError: numpy.core.\_multiarray\_umath failed to import
> ImportError: numpy.core.umath failed to import
> Traceback (most recent call last):
> File "qlearn.py", line 17, in \<module\>
> from keras.initializers import normal, identity
> File "C:\\Users\\Win 10\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\keras\\\_\_init\_\_.py", line 3, in \<module\>
> from . import utils
> File "C:\\Users\\Win 10\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\keras\\utils\\\_\_init\_\_.py", line 6, in \<module\>
> from . import conv\_utils
> File "C:\\Users\\Win 10\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\keras\\utils\\conv\_utils.py", line 9, in \<module\>
> from .. import backend as K
> File "C:\\Users\\Win 10\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\keras\\backend\\\_\_init\_\_.py", line 89, in \<module\>
> from .tensorflow\_backend import \*
> File "C:\\Users\\Win 10\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\keras\\backend\\tensorflow\_backend.py", line 5, in \<module\>
> import tensorflow as tf
> File "C:\\Users\\Win 10\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\\_\_init\_\_.py", line 24, in \<module\>
> from tensorflow.python import pywrap\_tensorflow # pylint: disable=unused-import
> File "C:\\Users\\Win 10\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\\_\_init\_\_.py", line 52, in \<module\>
> from tensorflow.core.framework.graph\_pb2 import \*
> File "C:\\Users\\Win 10\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\core\\framework\\graph\_pb2.py", line 6, in \<module\>
> from google.protobuf import descriptor as \_descriptor
> ModuleNotFoundError: No module named 'google.protobuf'\`

> <https://stackoverflow.com/questions/38680593/importerror-no-module-named-google-protobuf/47904556#47904556>

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [September 6, 2019, 4:53pm UTC](https://discuss.dgraph.io/t/modulenotfounderror-no-module-named-google/8229/2 "2019-09-06T16:53:03Z")

</div>

[martinmr](https://github.com/martinmr) _commented_ :

I think this is another instance of the issue fixed by this PR: [Catch pypandoc ModuleNotFoundError by robin-snt · Pull Request #81 · dgraph-io/pydgraph · GitHub](https://github.com/dgraph-io/pydgraph/pull/81)

I’ll release a new version of pydgraph with that change and verify it works.

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [September 6, 2019, 5:38pm UTC](https://discuss.dgraph.io/t/modulenotfounderror-no-module-named-google/8229/3 "2019-09-06T17:38:21Z")

</div>

[martinmr](https://github.com/martinmr) _commented_ :

@Tails I couldn’t reproduce the issue on my machine (probably because I am not starting from an empty environment) but I released a new version of pydgraph with the fix. Can you verify it’s working again for you? version number is 2.0.1

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [September 9, 2019, 12:56pm UTC](https://discuss.dgraph.io/t/modulenotfounderror-no-module-named-google/8229/4 "2019-09-09T12:56:52Z")

</div>

[Tails](https://github.com/Tails) _commented_ :

Fixed, thank you!

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [July 11, 2020, 4:28am UTC](https://discuss.dgraph.io/t/modulenotfounderror-no-module-named-google/8229/5 "2020-07-11T04:28:40Z")

</div>


