grpc-io installation failed

2,881 views
Skip to first unread message

Kausik Majumdar

unread,
Dec 22, 2015, 6:33:32 PM12/22/15
to grp...@googlegroups.com
Hi,
 
I am running error when I am trying to install *grpcio* in a Ubuntu system. I have python version 2.7 installed.
 
I have pretty much followed the steps to install grpc.
 
 
$ cd grpc
$ git submodule update –init
$ make
$ [sudo] make install prefix=/opt
 
When I tried to install grpcio ran into below errors. Any suggestion on how to solve this ?
 
 
>> sudo pip install grpcio
Downloading/unpacking grpcio
  Running setup.py egg_info for package grpcio
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/b/kmajumdar/grpc/grpc/build/grpcio/setup.py", line 112, in <module>
        cmdclass=_COMMAND_CLASS
      File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 260, in __init__
      File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 284, in fetch_build_eggs
      File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 569, in resolve
        dist = best.get(req.key)
    pkg_resources.VersionConflict: (Sphinx 1.1.3 (/usr/lib/python2.7/dist-packages), Requirement.parse('sphinx>=1.3'))
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
 
  File "<string>", line 14, in <module>
 
  File "$grpc/build/grpcio/setup.py", line 112, in <module>
 
    cmdclass=_COMMAND_CLASS
 
  File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
 
    _setup_distribution = dist = klass(attrs)
 
  File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 260, in __init__
 
  File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 284, in fetch_build_eggs
 
  File "/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 569, in resolve
 
    dist = best.get(req.key)
 
pkg_resources.VersionConflict: (Sphinx 1.1.3 (/usr/lib/python2.7/dist-packages), Requirement.parse('sphinx>=1.3'))
 
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /homes/kmajumdar/.pip/pip.log
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.0', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 116, in main
    return command.main(initial_args, args[1:], options)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 147, in main
    log_fp = open_logfile(log_fn, 'w')
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 176, in open_logfile
    log_fp = open(filename, mode)
IOError: [Errno 13] Permission denied: '/homes/kmajumdar/.pip/pip.log'
 
---------------------------------------------------------------------------------------------------------------------------
 
more /homes/kmajumdar/.pip/pip.log
------------------------------------------------------------
/usr/bin/pip run on Mon Dec 21 18:26:37 2015
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/dist-packages
Cleaning up...
  Removing temporary dir $grpc/grpc/build...
  Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
    self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 243, in run
    requirement_set.cleanup_files(bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1047, in cleanup_files
    rmtree(dir)
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 29, in rmtree
    onerror=rmtree_errorhandler)
  File "/usr/lib/python2.7/shutil.py", line 245, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 250, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 46, in rmtree_errorhandler
    os.chmod(path, stat.S_IWRITE)
 
Thanks,
Kausik
 

Michael Lumish

unread,
Dec 22, 2015, 6:39:48 PM12/22/15
to Kausik Majumdar, grp...@googlegroups.com
It looks like the primary problem is that grpcio requires a version of the library sphinx higher than the one you have installed. You should also not set prefix=/opt on "make install" without also setting that option on make, though that is probably not the cause of this specific problem.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CO2PR0501MB918617A1DF2CA13F8C32BB1B6E50%40CO2PR0501MB918.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Kausik Majumdar

unread,
Dec 22, 2015, 8:06:25 PM12/22/15
to Michael Lumish, grp...@googlegroups.com

Thanks Michael. After installing higher version of sphinx library I am not seeing this error anymore. However, I am hitting other error:

 

In file included from grpc/_adapter/_c/module.c:40:0:

 

./grpc/_adapter/_c/types.h:49:3: error: unknown type name ‘grpc_credentials’

 

I looked into the file and it is declared as below:

 

#ifndef GRPC__ADAPTER__C_TYPES_H_

#define GRPC__ADAPTER__C_TYPES_H_

 

#define PY_SSIZE_T_CLEAN

#include <Python.h>

#include <grpc/grpc.h>

#include <grpc/grpc_security.h>

 

 

/*=========================*/

/* Client-side credentials */

/*=========================*/

 

typedef struct ClientCredentials {

  PyObject_HEAD

  grpc_credentials *c_creds;

} ClientCredentials;

 

But I don’t see grpc_credentials is defined either in grpc.h or grpc_security.h. Do you know how to solve this issue ?

 

$ sudo pip install grpcio

Downloading/unpacking grpcio

  Running setup.py egg_info for package grpcio

   

Downloading/unpacking enum34>=1.0.4 (from grpcio)

  Running setup.py egg_info for package enum34

   

Downloading/unpacking futures>=2.2.0 (from grpcio)

  Running setup.py egg_info for package futures

   

Installing collected packages: grpcio, enum34, futures

  Running setup.py install for grpcio

    building 'grpc._adapter._c' extension

    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I. -I/usr/include/python2.7 -c grpc/_adapter/_c/module.c -o build/temp.linux-x86_64-2.7/grpc/_adapter/_c/module.o

    In file included from grpc/_adapter/_c/module.c:40:0:

    ./grpc/_adapter/_c/types.h:49:3: error: unknown type name \u2018grpc_credentials\u2019

    error: command 'gcc' failed with exit status 1

    Complete output from command /usr/bin/python -c "import setuptools;__file__='/b/kmajumdar/grpc/grpc/build/grpcio/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-kraQP9-record/install-record.txt:

    running install

 

running build

 

running build_py

 

running build_project_metadata

 

copying ./grpc/_grpcio_metadata.py -> build/lib.linux-x86_64-2.7/grpc

 

running build_ext

 

building 'grpc._adapter._c' extension

 

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I. -I/usr/include/python2.7 -c grpc/_adapter/_c/module.c -o build/temp.linux-x86_64-2.7/grpc/_adapter/_c/module.o

 

In file included from grpc/_adapter/_c/module.c:40:0:

 

./grpc/_adapter/_c/types.h:49:3: error: unknown type name ‘grpc_credentials’

 

error: command 'gcc' failed with exit status 1

 

----------------------------------------

Command /usr/bin/python -c "import setuptools;__file__='/b/kmajumdar/grpc/grpc/build/grpcio/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-kraQP9-record/install-record.txt failed with error code 1

Storing complete log in /homes/kmajumdar/.pip/pip.log

Traceback (most recent call last):

  File "/usr/bin/pip", line 9, in <module>

    load_entry_point('pip==1.0', 'console_scripts', 'pip')()

  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 116, in main

    return command.main(initial_args, args[1:], options)

  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 147, in main

    log_fp = open_logfile(log_fn, 'w')

  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 176, in open_logfile

    log_fp = open(filename, mode)

 

Michael Lumish

unread,
Dec 23, 2015, 11:57:56 AM12/23/15
to Kausik Majumdar, grp...@googlegroups.com

Your installation of the grpc C core may be too new. Try following the instructions in the repository to install the Debian package.

Kausik Majumdar

unread,
Dec 23, 2015, 2:43:13 PM12/23/15
to Michael Lumish, grp...@googlegroups.com

I was able to install successfully after applying the below patch.

 

diff -ru grpcio-0.11.0b1_pristine/grpc/_adapter/_c/types/client_credentials.c grpcio-0.11.0b1

/grpc/_adapter/_c/types/client_credentials.c

--- grpcio-0.11.0b1_pristine/grpc/_adapter/_c/types/client_credentials.c            2015-09-24 23

:28:43.000000000 +0530

+++ grpcio-0.11.0b1/grpc/_adapter/_c/types/client_credentials.c           2015-12-23 05:01:48.560000000

+0530

@@ -100,7 +100,9 @@

};

 void pygrpc_ClientCredentials_dealloc(ClientCredentials *self) {

+#ifdef GRPCIO_SECURE_CHANNEL

   grpc_credentials_release(self->c_creds);

+#endif

   self->ob_type->tp_free((PyObject *)self);

}

@@ -158,8 +160,10 @@

     return NULL;

   }

   self = (ClientCredentials *)type->tp_alloc(type, 0);

+#ifdef GRPCIO_SECURE_CHANNEL

   self->c_creds =

       grpc_composite_credentials_create(creds1->c_creds, creds2->c_creds, NULL);

+#endif

   if (!self->c_creds) {

     Py_DECREF(self);

     PyErr_SetString(PyExc_RuntimeError, "couldn't create composite credentials");

diff -ru grpcio-0.11.0b1_pristine/grpc/_adapter/_c/types.h grpcio-0.11.0b1/grpc/_adapter/_c/t

ypes.h

--- grpcio-0.11.0b1_pristine/grpc/_adapter/_c/types.h  2015-09-24 23:28:43.000000000 +0530

+++ grpcio-0.11.0b1/grpc/_adapter/_c/types.h 2015-12-23 04:27:33.728000000 +0530

@@ -46,7 +46,11 @@

 typedef struct ClientCredentials {

   PyObject_HEAD

+#ifdef GRPCIO_SECURE_CHANNEL

   grpc_credentials *c_creds;

+#else

+  void *c_creds;

+#endif

} ClientCredentials;

void pygrpc_ClientCredentials_dealloc(ClientCredentials *self);

ClientCredentials *pygrpc_ClientCredentials_google_default(

darkhan.i...@gmail.com

unread,
Jan 6, 2016, 12:12:51 AM1/6/16
to grpc.io, mlu...@google.com, kmaj...@juniper.net
could you please post or upload formatted version of your patch, I can't get it work

Thanks,
Darkhan

 </o:

Reply all
Reply to author
Forward
0 new messages