Skip to content

ModuleNotFoundError: No module named 'google' #80

@Tails

Description

@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

Stack trace

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

# 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

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

Related:
protocolbuffers/protobuf#6135
https://stackoverflow.com/a/47904556/399058

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions