Open schmiph2 opened 1 year ago
@schmiph2 Thanks for the feedback! I'll send this over to our software team for review.
Hi @schmiph2,
How are you pulling in the package? If you install via pypi/pip, the requirements are much more flexible. The requirements can by found in the pyproject.toml
file: https://github.com/saleae/logic2-automation/blob/develop/python/pyproject.toml
I do see 3.20.1 in the requirements.txt
file. I'll need to see if we depend on that anywhere, and possibly remove it.
I installed via pip on a venv on a Linux machine. When I pip-compile the requirements
logic2-automation
tensorflow==2.9.3
I get a compatible configuration (with protobuf==3.19.6). But when I install this configuration and try to from saleae import automation
I get the following error
Python 3.10.6 (main, Aug 2 2022, 15:11:28) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from saleae import automation
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-automation:
pip install logic2-automation --force-reinstall
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/mypath/venv/lib/python3.10/site-packages/saleae/automation/__init__.py", line 12, in <module>
raise exc from None
File /mypath/venv/lib/python3.10/site-packages/saleae/automation/__init__.py", line 2, in <module>
from saleae.grpc import saleae_pb2, saleae_pb2_grpc
File "/mypath/venv/lib/python3.10/site-packages/saleae/grpc/saleae_pb2.py", line 5, in <module>
from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/mypath/venv/lib/python3.10/site-packages/google/protobuf/internal/__init__.py)
>>>
I do really know nothing about protobuf, so I'm a bit lost here
Hi @schmiph2,
I can reproduce this locally. The core issue is that the latest version of grpcio_tools is being used to build the python protobuf files, which will be incompatible with 3.19.6. Unfortunately you can't also pin grpcio_tools to an older version - I think this is a new issue related to moving grpcio_tools
to be a build-time only dependency.
A workaround is to pin the versions in logic2-automation. This isn't a fix we can merge, but you can try installing this package:
logic2_automation-1.0.7a1.tar.gz
You can put that next to your requirements.txt
and update requirements.txt to ./logic2_automation-1.0.7a1.tar.gz
--
I'll need to do more testing on this. I don't think we will get a proper fix published soon, but I will update here when we do.
Please let me know if that works for you,
Ryan
Hi Ryan
Sorry for the late reply and thank you for the fix. It works with the archive you've attached. But unfortunately this doesn't solve my problem, as I want to use logic2-automation
in a bigger repo where such "hacks" as placing the code just next to the requirements.txt is not possible. Do you think I could use logic2-automation==1.0.5
and pin the grpcio_tools
version?
Just tested it, it doesn't work with logic2-automation==1.0.5
and pin the grpcio_tools
. It obviously works only when I set the --no-build-isolation
flag during installation. But thats also something we don't want.
Hi everyone
Thanks for the great package. Its working really good. One thing that's blocking me are the strict requirements (all versions set by == and not >). Could you fix this? I assume the versions could be quite flexible. The requirement thats hurting me the most is protobuf==3.20.1 as this is conflicting with my Tensorflow requirements (obviously, these could be installed in separate venvs, but its making my workflow much more complicated).
Thanks for your help!