Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

No module named 'sawtooth_sdk.protobuf' #36

Open
m-unkel opened this issue Feb 25, 2022 · 1 comment
Open

No module named 'sawtooth_sdk.protobuf' #36

m-unkel opened this issue Feb 25, 2022 · 1 comment

Comments

@m-unkel
Copy link

m-unkel commented Feb 25, 2022

Failed to import Stream from sawtooth_sdk.messaging.stream, because submodule protobuf is missing since 1.2.4.

from sawtooth_sdk.messaging.stream import Stream
 Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/sawtooth_sdk/messaging/stream.py", line 27, in <module>
    from sawtooth_sdk.protobuf import validator_pb2
ModuleNotFoundError: No module named 'sawtooth_sdk.protobuf'

Python 3.8
sawtooth-sdk 1.2.4
ubuntu 20.04

The problem seems to be in the provided wheel package.

Workaround
A workaround is to add the option "--no-binary sawtooth-sdk" to pip install command.
pip3 install --no-binary sawtooth-sdk sawtooth-sdk
This will work in your CLI, but not in a pipeline, because of get_version binary not found.

error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-hhm8lglm/sawtooth-sdk_0c643808dfc240c0bf0852[844](***#L844)1366b27/setup.py", line 37, in <module>
          version=subprocess.check_output(
        File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/usr/lib/python3.8/subprocess.py", line 493, in run
          with Popen(*popenargs, **kwargs) as process:
        File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: './bin/get_version'
      [end of output]

Workaround 2
This will work for pipelines.

python3 -m pip install grpcio-tools
git clone --depth 1 --branch v1.2.4 https://github.com/hyperledger/sawtooth-sdk-python.git
python3 sawtooth-sdk-python/bin/protogen
python3 -m pip install sawtooth-sdk-python/
rm -rf sawtooth-sdk-python
@abhishekbisht1429
Copy link

I had the same issue, workaround 2 by @m-unkel worked for me. But is this issue still pending ? I wonder how other people are working with the sdk.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants