bazelbuild / rules_docker

Rules for building and handling Docker images with Bazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: cannot import name 'cygrpc' from 'grpc._cython'

wsoesanto opened this issue Β· comments

🐞 bug report

Affected Rule

py3_image

Is this a regression?

No, this issue has been occuring since #1561.

Description

A clear and concise description of the problem...

πŸ”¬ Minimal Reproduction

https://github.com/wsoesanto/docker_python

πŸ”₯ Exception or Error



Traceback (most recent call last):
  File "/app//main.binary.runfiles/__main__/main.py", line 1, in 
    import grpc
  File "/app/main.binary.runfiles/pypi_grpcio/site-packages/grpc/__init__.py", line 22, in 
    from grpc import _compression
  File "/app/main.binary.runfiles/pypi_grpcio/site-packages/grpc/_compression.py", line 20, in 
    from grpc._cython import cygrpc
ImportError: cannot import name 'cygrpc' from 'grpc._cython' 

🌍 Your Environment

Operating System:

  
$ uname -a
Darwin 192.168.1.5 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64
  

Output of bazel version:

  
$ bazel version
Bazelisk version: development
Build label: 5.3.2
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Oct 19 18:35:48 2022 (1666204548)
Build timestamp: 1666204548
Build timestamp as int: 1666204548
  

Rules_docker version:

  
Using master as using other versions not working as well.
  

Anything else relevant?

The problem is that bazel is happily copying the darwin compiled lib for grpc, instead of one compatible with your container's platform. Take a look here how to download the wheels that will work for you: bazelbuild/rules_python#773 (comment)

You will probably want to use the multilinux_2_17 wheels.