lumoz-ai / brick-python-sdk

Python SDK for building bricks compatible with Lumoz Platform
1 stars 1 forks source link

Unable to create bricks on macOS #14

Open hrisheekeshr opened 4 years ago

hrisheekeshr commented 4 years ago

The import statement throws an error after brick is built, nothing while building.

How to reproduce:

Install the latest bricksdk==0.1.5

(venv) hrisheekeshr@Hrisheekeshs-Macbook-Pro brick_test % pip install bricksdk==0.1.5
Collecting bricksdk==0.1.5
  Downloading https://files.pythonhosted.org/packages/b8/c0/2b8078e4d76d0134acbddb961cc3f81d7223b34ba026deb30cc273fa307c/bricksdk-0.1.5-py3-none-any.whl
Collecting grpcio (from bricksdk==0.1.5)
  Using cached https://files.pythonhosted.org/packages/59/75/5a949d048d96ecb3c304f14975f8a0965cb0d3c3f5f5f6b3f4e15c3d49eb/grpcio-1.29.0-cp37-cp37m-macosx_10_9_x86_64.whl
Collecting grpcio-tools (from bricksdk==0.1.5)
  Using cached https://files.pythonhosted.org/packages/c2/49/53f381e8f8043550477eb0219f8167811c2c56e7040d2e48aa87b4f12c51/grpcio_tools-1.29.0-cp37-cp37m-macosx_10_9_x86_64.whl
Collecting template-store (from bricksdk==0.1.5)
  Using cached https://files.pythonhosted.org/packages/da/30/a3aeb45e06b8bc17fa85e2877b2318c63f78dc115cc479d3aa99c3a39255/template_store-0.1.0-py3-none-any.whl
Collecting six>=1.5.2 (from grpcio->bricksdk==0.1.5)
  Using cached https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting protobuf>=3.5.0.post1 (from grpcio-tools->bricksdk==0.1.5)
  Using cached https://files.pythonhosted.org/packages/1a/f6/07639f5458d6f350e26eb15ff675bf4f100b544f008fa3a3dc07fcf89fac/protobuf-3.12.1-cp37-cp37m-macosx_10_9_x86_64.whl
Requirement already satisfied: setuptools in ./venv/lib/python3.7/site-packages (from protobuf>=3.5.0.post1->grpcio-tools->bricksdk==0.1.5) (40.8.0)
Installing collected packages: six, grpcio, protobuf, grpcio-tools, template-store, bricksdk
Successfully installed bricksdk-0.1.5 grpcio-1.29.0 grpcio-tools-1.29.0 protobuf-3.12.1 six-1.15.0 template-store-0.1.0

Try to create a new brick

(venv) hrisheekeshr@Hrisheekeshs-Macbook-Pro brick_test % brick create -n 'input_brick'
Traceback (most recent call last):
  File "/Users/hrisheekeshr/brick_test/venv/bin/brick", line 6, in <module>
    from bricksdk.brick_commands.brick import brick
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/bricksdk/brick_commands/brick.py", line 5, in <module>
    from bricksdk.brick_commands.command_handler import BrickCommandHandler
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/bricksdk/brick_commands/command_handler.py", line 4, in <module>
    from . import create, proto
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/bricksdk/brick_commands/create.py", line 3, in <module>
    from template_store.simple_template_store import SimpleTemplateStore
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/template_store/simple_template_store.py", line 4, in <module>
    from pip._vendor import requests
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/pip/_vendor/requests/__init__.py", line 94, in <module>
    from pip._internal.utils.compat import WINDOWS
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
    from pip._internal.commands import (
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
    from pip._internal.commands.completion import CompletionCommand
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
    from pip._internal.cli.base_command import Command
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 20, in <module>
    from pip._internal.download import PipSession
  File "/Users/hrisheekeshr/brick_test/venv/lib/python3.7/site-packages/pip/_internal/download.py", line 332, in <module>
    class PipSession(requests.Session):
AttributeError: module 'pip._vendor.requests' has no attribute 'Session'
`

Same commands were tested on Linux and everything seems to be working

karthikpanicker commented 4 years ago

@hrisheekeshr seem to work fine for me. Whats the pip version that you are using?

hrisheekeshr commented 4 years ago

@hrisheekeshr seem to work fine for me. Whats the pip version that you are using?

@karthikpanicker I was using pip 19.0.3. I upgraded pip to 20.1.1 and the initial issues seems to be fixed now.

While continuing this I faced another issue, https://github.com/lumoz-ai/brick-python-sdk/issues/15

After a temporary workaround, after I managed to download the proto files and compile them, I ended up with some weird file names, and import errors ending with -E.

Upon initial debugging, it seems like an issue while executing the method that cleans up the import statement that seems to be working in Linux based systems but, not on macOS.

https://github.com/lumoz-ai/brick-python-sdk/blob/ff8711d2a4a54a4b9e5b1d16371deb2a27a46f48/bricksdk/connectors/grpc/proto_processor/processor.py#L222