Packaging python grpc app with cx_freeze

58 views
Skip to first unread message

da...@powerline-technologies.com

unread,
Mar 22, 2017, 7:44:32 AM3/22/17
to grpc.io

Hi

I have recently developed an app which includes grpc, which works fine in Python.  I am now trying to package this using cx_Freeze.  I've fixed a number of issues with missing packages, but have now hit a brick wall.

The problem is with the import grpc statement in one of my modules.  The problem is related to the line

from grpc._cython import cyygrpc as _cygrpc in grpc/__init__.py

It complains that the packaging package is required.  I forced it to load all of the packages under pkg_resources/_vendor but it still complains that the packaging.requirements package is required even though its physically present in the build file.

Since I don't really know what this code is doing I am a bit lost.  Can anyone help? 

Nathaniel Manista

unread,
Mar 22, 2017, 9:46:07 PM3/22/17
to da...@powerline-technologies.com, grpc.io
On Wed, Mar 22, 2017 at 4:44 AM, <da...@powerline-technologies.com> wrote:
I have recently developed an app which includes grpc, which works fine in Python. I am now trying to package this using cx_Freeze.

This is the first I've heard of cx_Freeze but I'll try to be helpful.

I've fixed a number of issues with missing packages, but have now hit a brick wall.

The problem is with the import grpc statement in one of my modules. The problem is related to the line


gRPC Python isn't implemented purely in Python and this statement is the first place where a running application would load modules that we've implemented in Cython.

It complains that the packaging package is required. I forced it to load all of the packages under pkg_resources/_vendor but it still complains that the packaging.requirements package is required even though its physically present in the build file.

This sounds very strange; I don't think I have any idea of where this is coming from.

Since I don't really know what this code is doing I am a bit lost. Can anyone help?

How well do you generally know using cx_Freeze with Python libraries implemented in some combination of Python, Cython, and C? That intersection of topics might be one place to look.

How well have you gotten to know the gRPC Python codebase in the time that you've been working with it? Have you cloned the repository, run all the tests, built your own packages, and... anything else?

My apologies that I don't have properly-informed guidance to offer,
-Nathaniel

da...@powerline-technologies.com

unread,
Mar 23, 2017, 7:21:22 AM3/23/17
to grpc.io
Hi Nathaniel

Thanks for this input the problem definitely seems to be related to loading the cython files.  in the cygrpc.pyd file you import a bunch of .pxi files.  Where do these file live in the site packages tree?  I cannot find them, but they must be there since the straight python version works fine.

I have not encountered cython before, so please excuse my ignorance.

David.

Nathaniel Manista

unread,
Mar 23, 2017, 11:31:19 AM3/23/17
to da...@powerline-technologies.com, grpc.io
On Thu, Mar 23, 2017 at 4:21 AM, <da...@powerline-technologies.com> wrote:
Thanks for this input the problem definitely seems to be related to loading the cython files. in the cygrpc.pyd file you import a bunch of .pxi files.


Where do these file live in the site packages tree? I cannot find them, but they must be there since the straight python version works fine.

I don't think any Cython files are included in the site-packages tree.

I have not encountered cython before, so please excuse my ignorance.

You may need to spend some time with it before you'll be able to accomplish what you're attempting.
-N
Reply all
Reply to author
Forward
0 new messages