google / digitalbuildings

Digital Buildings (ontology and SDK) currently being used by Google internally to manage our own buildings.
Apache License 2.0
371 stars 137 forks source link

instance_validator.py setup instructions don't work on M1 macOS #748

Closed gnmerritt closed 2 years ago

gnmerritt commented 2 years ago

Describe the bug Following the instructions in tools/validators/instance_validator/README.md doesn't work

To Reproduce

# follow instructions
# 2. Run `python3 setup.py install` from digitalbuildings/tools/validators/ontology_validator.
# 3. Run `python3 setup.py install` from digitalbuildings/tools/validators/instance_validator.

$ python3 instance_validator.py --input my-file.yaml
Traceback (most recent call last):
  File "/Users/nathan/sources/onboard/digitalbuildings/tools/validators/instance_validator/instance_validator.py", line 32, in <module>
    from validate import handler
  File "/Users/nathan/sources/onboard/digitalbuildings/tools/validators/instance_validator/validate/handler.py", line 26, in <module>
    from validate import subscriber
  File "/Users/nathan/sources/onboard/digitalbuildings/tools/validators/instance_validator/validate/subscriber.py", line 23, in <module>
    from google.cloud import pubsub_v1
  File "/Users/nathan/.pyenv/versions/onboard-goog-digbuild/lib/python3.10/site-packages/google_cloud_pubsub-2.6.1-py3.10.egg/google/cloud/pubsub_v1/__init__.py", line 17, in <module>
    from google.cloud.pubsub_v1 import types
  File "/Users/nathan/.pyenv/versions/onboard-goog-digbuild/lib/python3.10/site-packages/google_cloud_pubsub-2.6.1-py3.10.egg/google/cloud/pubsub_v1/types.py", line 25, in <module>
    from google.api_core import gapic_v1
  File "/Users/nathan/.pyenv/versions/onboard-goog-digbuild/lib/python3.10/site-packages/google_api_core-1.32.0-py3.10.egg/google/api_core/gapic_v1/__init__.py", line 18, in <module>
    from google.api_core.gapic_v1 import config
  File "/Users/nathan/.pyenv/versions/onboard-goog-digbuild/lib/python3.10/site-packages/google_api_core-1.32.0-py3.10.egg/google/api_core/gapic_v1/config.py", line 23, in <module>
    import grpc
  File "/Users/nathan/.pyenv/versions/onboard-goog-digbuild/lib/python3.10/site-packages/grpcio-1.48.0-py3.10-macosx-12-arm64.egg/grpc/__init__.py", line 22, in <module>
  File "/Users/nathan/.pyenv/versions/onboard-goog-digbuild/lib/python3.10/site-packages/grpcio-1.48.0-py3.10-macosx-12-arm64.egg/grpc/_compression.py", line 17, in <module>
    if not self.readable():
AttributeError: module 'grpc._cython.cygrpc' has no attribute 'CompressionAlgorithm'

Expected behavior grpc import shouldn't fail.

I was able to get things to work via:

$ python3 -m pip install --no-binary :all: grpcio --ignore-installed
$ python3 -m pip install --no-binary :all: grpcio-tools --ignore-installed

OS (please complete the following information):

$ uname -a
Darwin ip-192-168-11-50.ec2.internal 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64
$ python3 --version
Python 3.10.6
$ pyenv --version
pyenv 2.3.3
$ clang --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
charbull commented 2 years ago

Hi @gnmerritt I just merged this PR: https://github.com/google/digitalbuildings/pull/739 to support pip can you please give it a try?

gnmerritt commented 2 years ago

Yep, python3 -m pip install . works after your merge. Thanks!