baking-bad / pytezos

🐍 Python SDK for Tezos | Michelson VM in Python
https://pytezos.org
MIT License
111 stars 36 forks source link

can't install pytezos on python 3.12 #360

Closed nicolasochem closed 2 months ago

nicolasochem commented 6 months ago

pysha3 error

Building wheels for collected packages: pysha3, secp256k1, pyblake2, pyzmq                                                                                    
  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                                                                                                                                              
  ╰─> [18 lines of output]                                                                                                                                    
      running bdist_wheel                                                                                                                                     
      running build                                                                                                                                           
      running build_py                                                                                                                                        
      creating build                                                                                                                                          
      creating build/lib.linux-x86_64-cpython-312                                                                                                             
      copying sha3.py -> build/lib.linux-x86_64-cpython-312                                                                                                   
      running build_ext                                                                                                                                       
      building '_pysha3' extension                                                                                                                            
      creating build/temp.linux-x86_64-cpython-312                                                                                                            
      creating build/temp.linux-x86_64-cpython-312/Modules                                                                                                    
      creating build/temp.linux-x86_64-cpython-312/Modules/_sha3                                                                                              
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions 
-fcf-protection -fPIC -DPY_WITH_KECCAK=1 -I/home/nochem/workspace/tezos-k8s/mkchain/venv/include -I/usr/include/python3.12 -c Modules/_sha3/sha3module.c -o bu
ild/temp.linux-x86_64-cpython-312/Modules/_sha3/sha3module.o                                                                                                  
      In file included from Modules/_sha3/sha3module.c:20:                                                                                                    
      Modules/_sha3/backport.inc:78:10: fatal error: pystrhex.h: No such file or directory                                                                    
         78 | #include "pystrhex.h"                                                                                                                           
            |          ^~~~~~~~~~~~                                                                                                                           
      compilation terminated.                                                                                                                                 
      error: command '/usr/bin/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     

Aparently it's deprecated

secp256k1

 error: invalid use of incomplete typedef ‘ECDSA_S
IG’ {aka ‘struct ECDSA_SIG_st’}

pyblake2

  pyblake2module.c: In function ‘PyInit_pyblake2’:                                                                                                        
  pyblake2module.c:699:27: error: lvalue required as left operand of assignment                                                                           
    699 |     Py_TYPE(&blake2bType) = &PyType_Type;                                                                                                       
        |                           ^                                                                                                                     
  pyblake2module.c:703:27: error: lvalue required as left operand of assignment                                                                           
    703 |     Py_TYPE(&blake2sType) = &PyType_Type;                                                                                                       
        |                           ^                                                                                                                     
  error: command '/usr/bin/gcc' failed with exit code 1                                                                                                   
  [end of output]                                                                                                                                         

pyzmq

warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
hoh commented 2 months ago

On the same topic of pytezos not working on Python 3.12, I am facing issues related to secp256k1 that prevent me from using pytezos with Python 3.12.

That library seems has not seen any update for more than 2 years, would it make sense to fork it or replace it with coincurve ?

droserasprout commented 2 months ago

I agree, secp256k1 is a pain in the ass. Coincidentally, I am currently investating another weird issue in CI! https://github.com/baking-bad/pytezos/actions/runs/9614856495/job/26520674888

coincurve is nice and well-maintained; we should definitely make a switch. But this library not a drop-in replacement, so it's not an instant task.

droserasprout commented 2 months ago

Closing, py3.12 is supported since 3.12.0 and seems to be working.

To fix the secp256k1 issue drop the virtual environment and CI cache.