sawtooth-core icon indicating copy to clipboard operation
sawtooth-core copied to clipboard

Problem with protocol buffer

Open MarioPalomaresGallego opened this issue 3 years ago • 0 comments

Hi,

While following the steps on https://sawtooth.hyperledger.org/docs/core/releases/latest/app_developers_guide/ubuntu.html i have encountered some problem when executing STEP 4.4 the error is the following:

[....] File "/usr/lib/python3/dist-packages/sawtooth_cli/protobuf/transaction_pb2.py", line 22 [...] TypeError: new() got an unexpected keyword argument 'serialized_options'

I have been looking arround and have seen that this problem arises when the *_pb2.py files are generarted by a version of the protoc compiler newer than the protocol buffer runtime library.

I have tried to upgrade my python runtime library but still get the same error. The current version of the protocol bufffer library is:

Name: protobuf Version: 3.15.8 Summary: Protocol Buffers Home-page: https://developers.google.com/protocol-buffers/ Author: None Author-email: None License: 3-Clause BSD License Location: /home/mario/.local/lib/python3.6/site-packages Requires: six Required-by: sawtooth-sdk

I have checked in the sys.path just to see if the package is installed with different version on different path but my search path is

Python 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import sys sys.path [' ', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/mario/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/dist-packages', '/usr/local/lib/python3.6/dist-packages/dnspython-2.1.1.dev32+geed2172-py3.6.egg', '/usr/lib/python3/dist-packages']

As you can see the path for the protobuf that the pip command shows is in fourth place and none of the previous paths contain a protocol buffer library so don´t know what can be going on.

Does anyone know what could be happening

EDIT

I have just realized that the command on STEP 4 run the command as another user with the "sudo -u sawtooth" so i am pretty sure that the /home/mario/.local/.... path is not available for that command since that is a user-scope path. Sawtooth user does not have a local download of protobuf package and instead the search for the protobuf package is falling on the last path (/usr/lib/python3/dist-packages) there it is another protobuf intalation, this time verison 3.0.0, don´t know when the package was intalled here i assume during sawtooth intalation but seems weird since that version makes the environment to fail.

Not sure how to tell pip to upgrade not the local package but the global one, installed on the previous path, i have tried with sudo but it doesn´t work.

This explanation seems reasonable but I am not sure why nobody has this problem. If someone could confirm it would be helpful.

EDIT 2

Alright so i have managed to tell pip how to update the packaged contained in the /usr/lib/python3/dist-packages and know it works. Actually after solving this i had a couple more errors:

  • The sawtooth_signing package was missing
  • The sawtooth_sdk package was also missing

Again these packages were intalled under /home/mario/... so i had to intall them on the other location, but while trying to install them i got another weird behaviour, pip was trying to install dependencies of these packages which were already installed and to make matters worse installing those dependencies generate an error, specifically the error had to do with the secp256k1 package which failed compilation. Its seems that pip defaulted to --ignore-installed behaviour.

Basically in case you end up with the same installation problem on you enviroment what you have to do is install the missing packages manually with the following command:

sudo python -m pip -t /usr/lib/python3/dist-packages/ --no-deps protobuf sawtooth_sdk sawtooth_signing

Hope this issue serves for somebody else facing the same problem.

MarioPalomaresGallego avatar Apr 18 '21 10:04 MarioPalomaresGallego