hyperledger / fabric-sdk-py

Hyperledger Fabric Python SDK
https://fabric-sdk-py.readthedocs.io/en/latest/
Apache License 2.0
405 stars 200 forks source link

Unable to install fabric-sdk-py using pip install - Failed to build pysha3 #188

Closed davidfdr closed 7 months ago

davidfdr commented 8 months ago

Getting error when trying to install fabric-sdk-py using PIP.

 pip install -U fabric-sdk-py

Collecting fabric-sdk-py
  Obtaining dependency information for fabric-sdk-py from https://files.pythonhosted.org/packages/17/ef/5bb42e639af3a4fea9fcc75d4faa5d57476b4170b2870e72e66093118809/fabric_sdk_py-1.0.0-py3-none-any.whl.metadata
  Using cached fabric_sdk_py-1.0.0-py3-none-any.whl.metadata (4.5 kB)
Collecting aiogrpc>=1.6 (from fabric-sdk-py)
  Obtaining dependency information for aiogrpc>=1.6 from https://files.pythonhosted.org/packages/16/db/bd010b6fed762952142100da5707a769143af7a1795caa8d8bdff9d9ca85/aiogrpc-1.8-py3-none-any.whl.metadata
  Using cached aiogrpc-1.8-py3-none-any.whl.metadata (619 bytes)
Requirement already satisfied: cryptography>=1.9 in /home/david-reis/.local/python3/lib/python3.11/site-packages (from fabric-sdk-py) (42.0.5)
Collecting grpcio>=1.0.1 (from fabric-sdk-py)
  Obtaining dependency information for grpcio>=1.0.1 from https://files.pythonhosted.org/packages/7e/61/79618621c56244d4778811f98737af8be4af1c0b034261c270cdfbda0762/grpcio-1.62.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Using cached grpcio-1.62.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.0 kB)
Collecting hkdf>=0.0.3 (from fabric-sdk-py)
  Using cached hkdf-0.0.3-py3-none-any.whl
Collecting lark-parser==0.7.1 (from fabric-sdk-py)
  Using cached lark_parser-0.7.1-py2.py3-none-any.whl
Collecting pycryptodomex>=3.4.2 (from fabric-sdk-py)
  Obtaining dependency information for pycryptodomex>=3.4.2 from https://files.pythonhosted.org/packages/20/7a/3162173af8597f0399b45c6aaa4939ccae908476fdf1b3a3cc30631fc9fb/pycryptodomex-3.20.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Using cached pycryptodomex-3.20.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.4 kB)
Collecting pysha3==1.0b1 (from fabric-sdk-py)
  Using cached pysha3-1.0b1.tar.gz (828 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting requests==2.20.0 (from fabric-sdk-py)
  Obtaining dependency information for requests==2.20.0 from https://files.pythonhosted.org/packages/f1/ca/10332a30cb25b627192b4ea272c351bce3ca1091e541245cccbace6051d8/requests-2.20.0-py2.py3-none-any.whl.metadata
  Using cached requests-2.20.0-py2.py3-none-any.whl.metadata (5.6 kB)
Collecting rx>=3.0.1 (from fabric-sdk-py)
  Obtaining dependency information for rx>=3.0.1 from https://files.pythonhosted.org/packages/e2/a9/efeaeca4928a9a56d04d609b5730994d610c82cf4d9dd7aa173e6ef4233e/Rx-3.2.0-py3-none-any.whl.metadata
  Using cached Rx-3.2.0-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: six>=1.4.0 in /home/david-reis/.local/python3/lib/python3.11/site-packages (from fabric-sdk-py) (1.16.0)
Collecting protobuf>=3.6.0 (from fabric-sdk-py)
  Obtaining dependency information for protobuf>=3.6.0 from https://files.pythonhosted.org/packages/15/db/7f731524fe0e56c6b2eb57d05b55d3badd80ef7d1f1ed59db191b2fdd8ab/protobuf-4.25.3-cp37-abi3-manylinux2014_x86_64.whl.metadata
  Using cached protobuf-4.25.3-cp37-abi3-manylinux2014_x86_64.whl.metadata (541 bytes)
Collecting couchdb>=1.2 (from fabric-sdk-py)
  Obtaining dependency information for couchdb>=1.2 from https://files.pythonhosted.org/packages/ff/35/6660f7526c5d509b13264b27642de73754bd3d0addf56b175601c8b951e1/CouchDB-1.2-py2.py3-none-any.whl.metadata
  Using cached CouchDB-1.2-py2.py3-none-any.whl.metadata (930 bytes)
Collecting chardet<3.1.0,>=3.0.2 (from requests==2.20.0->fabric-sdk-py)
  Obtaining dependency information for chardet<3.1.0,>=3.0.2 from https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl.metadata
  Using cached chardet-3.0.4-py2.py3-none-any.whl.metadata (3.2 kB)
Collecting idna<2.8,>=2.5 (from requests==2.20.0->fabric-sdk-py)
  Obtaining dependency information for idna<2.8,>=2.5 from https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl.metadata
  Using cached idna-2.7-py2.py3-none-any.whl.metadata (8.9 kB)
Collecting urllib3<1.25,>=1.21.1 (from requests==2.20.0->fabric-sdk-py)
  Obtaining dependency information for urllib3<1.25,>=1.21.1 from https://files.pythonhosted.org/packages/01/11/525b02e4acc0c747de8b6ccdab376331597c569c42ea66ab0a1dbd36eca2/urllib3-1.24.3-py2.py3-none-any.whl.metadata
  Using cached urllib3-1.24.3-py2.py3-none-any.whl.metadata (36 kB)
Requirement already satisfied: certifi>=2017.4.17 in /home/david-reis/.local/python3/lib/python3.11/site-packages (from requests==2.20.0->fabric-sdk-py) (2024.2.2)
Requirement already satisfied: cffi>=1.12 in /home/david-reis/.local/python3/lib/python3.11/site-packages (from cryptography>=1.9->fabric-sdk-py) (1.16.0)
Requirement already satisfied: pycparser in /home/david-reis/.local/python3/lib/python3.11/site-packages (from cffi>=1.12->cryptography>=1.9->fabric-sdk-py) (2.21)
Using cached fabric_sdk_py-1.0.0-py3-none-any.whl (262 kB)
Using cached requests-2.20.0-py2.py3-none-any.whl (60 kB)
Using cached aiogrpc-1.8-py3-none-any.whl (10 kB)
Using cached CouchDB-1.2-py2.py3-none-any.whl (67 kB)
Using cached grpcio-1.62.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.5 MB)
Using cached protobuf-4.25.3-cp37-abi3-manylinux2014_x86_64.whl (294 kB)
Using cached pycryptodomex-3.20.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
Using cached Rx-3.2.0-py3-none-any.whl (199 kB)
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Using cached idna-2.7-py2.py3-none-any.whl (58 kB)
Using cached urllib3-1.24.3-py2.py3-none-any.whl (118 kB)
Building wheels for collected packages: pysha3
  Building wheel for pysha3 (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pysha3 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [74 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      copying sha3.py -> build/lib.linux-x86_64-cpython-311
      running build_ext
      building '_sha3' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/Modules
      creating build/temp.linux-x86_64-cpython-311/Modules/_sha3
      x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -g -fwrapv -O2 -fPIC -I/home/david-reis/.local/python3/include -I/usr/include/python3.11 -c Modules/_sha3/sha3module.c -o build/temp.linux-x86_64-cpython-311/Modules/_sha3/sha3module.o
      Modules/_sha3/sha3module.c: In function ‘PyInit__sha3’:
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:787:5: note: in expansion of macro ‘init_sha3type’
        787 |     init_sha3type("sha3_224", &SHA3_224type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:788:5: note: in expansion of macro ‘init_sha3type’
        788 |     init_sha3type("sha3_256", &SHA3_256type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:789:5: note: in expansion of macro ‘init_sha3type’
        789 |     init_sha3type("sha3_384", &SHA3_384type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:790:5: note: in expansion of macro ‘init_sha3type’
        790 |     init_sha3type("sha3_512", &SHA3_512type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:792:5: note: in expansion of macro ‘init_sha3type’
        792 |     init_sha3type("keccak_224", &Keccak_224type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:793:5: note: in expansion of macro ‘init_sha3type’
        793 |     init_sha3type("keccak_256", &Keccak_256type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:794:5: note: in expansion of macro ‘init_sha3type’
        794 |     init_sha3type("keccak_384", &Keccak_384type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:795:5: note: in expansion of macro ‘init_sha3type’
        795 |     init_sha3type("keccak_512", &Keccak_512type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:797:5: note: in expansion of macro ‘init_sha3type’
        797 |     init_sha3type("shake_128", &SHAKE128type);
            |     ^~~~~~~~~~~~~
      Modules/_sha3/sha3module.c:777:23: error: lvalue required as left operand of assignment
        777 |         Py_TYPE(type) = &PyType_Type; \
            |                       ^
      Modules/_sha3/sha3module.c:798:5: note: in expansion of macro ‘init_sha3type’
        798 |     init_sha3type("shake_256", &SHAKE256type);
            |     ^~~~~~~~~~~~~
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pysha3
Failed to build pysha3
ERROR: Could not build wheels for pysha3, which is required to install pyproject.toml-based projects
jeriox commented 7 months ago

I already fixed this in https://github.com/hyperledger/fabric-sdk-py/pull/186 because I stumbled upon the same problem. But as there hasn't been a release in years, installing from PyPI does not include this fix. You can install from the git repo instead (pip install git+https://github.com/hyperledger/fabric-sdk-py)

davidfdr commented 7 months ago

Thank you very much. I am configuring the Hyperledger Fabric Operator and using the ansible collections to deploy the fabric.

dexhunter commented 7 months ago

Yes, you can install via git repo, also since fabric-gateway client apis are used for fabric v2.4+ I think we will switch to using fabric-gateway as per #153