saleae / logic2-automation

Logic2 Automation API
https://saleae.github.io/logic2-automation/
Apache License 2.0
19 stars 8 forks source link

Breaking on macOS Monterey between v1.0.3 and v1.0.4 #13

Closed alexhrao closed 2 years ago

alexhrao commented 2 years ago

The automation API fails to load in version 1.0.4:

$ pip install logic2-automation==1.0.4 --force-reinstall
...
Successfully installed grpcio-1.50.0 grpcio-tools-1.50.0 logic2-automation-1.0.4 protobuf-4.21.9 setuptools-65.5.0 six-1.16.0
$ python3 saleae_example.py
There was an error that occurred while importing grpc/pb modules.
This can be caused by pb files that were generated using an incompatible version of protobuf.
You can regenerate these files by reinstalling logic2-automaation:

     pip --force-reinstall logic2-automation

 Traceback (most recent call last):
  File "/Users/alerao/Documents/ms1-analyzer/saleae_example.py", line 1, in <module>
    from saleae import automation
  File "/Users/alerao/Documents/ms1-analyzer/venv/lib/python3.10/site-packages/saleae/automation/__init__.py", line 12, in <module>
    raise exc from None
  File "/Users/alerao/Documents/ms1-analyzer/venv/lib/python3.10/site-packages/saleae/automation/__init__.py", line 2, in <module>
    from saleae.grpc import saleae_pb2, saleae_pb2_grpc
ModuleNotFoundError: No module named 'saleae.grpc'
$ python saleae_example.py
There was an error that occurred while importing grpc/pb modules.
This can be caused by pb files that were generated using an incompatible version of protobuf.
You can regenerate these files by reinstalling logic2-automaation:

     pip --force-reinstall logic2-automation

 Traceback (most recent call last):
  File "/Users/alerao/Documents/ms1-analyzer/saleae_example.py", line 1, in <module>
    from saleae import automation
  File "/Users/alerao/Documents/ms1-analyzer/venv/lib/python3.10/site-packages/saleae/automation/__init__.py", line 12, in <module>
    raise exc from None
  File "/Users/alerao/Documents/ms1-analyzer/venv/lib/python3.10/site-packages/saleae/automation/__init__.py", line 2, in <module>
    from saleae.grpc import saleae_pb2, saleae_pb2_grpc
ModuleNotFoundError: No module named 'saleae.grpc'

Reinstallation doesn't help, but downgrading to version 1.0.3 makes it work. I haven't had a chance to figure out why, but I thought I'd let you know!

$ pip install logic2-automation==1.0.3 --force-reinstall
...
Successfully installed grpcio-1.50.0 grpcio-tools-1.50.0 logic2-automation-1.0.3 protobuf-4.21.9 setuptools-65.5.0 six-1.16.0
$ python3 saleae_example.py
$ python saleae_example.py

This creates the folders as expected

huffman commented 2 years ago

@alexhrao Thanks for the report!

We released 1.0.5 yesterday to address this. Could you try updating to see if it resolves your issue?

alexhrao commented 2 years ago

It worked!

alexhrao commented 2 years ago

I'm curious actually, what was the root cause?

EDIT: Ah I see you all already answered that question:

  • The protobuf files (saleae/grpc) generated during the .whl build were not being included in the .whl file. This was caused by the saleae/grpc directory being added to the .gitignore file. These ignored files have been moved to the parent directory's .gitignore, and an empty .gitignore has been added to the python directory.