ggerganov / ggwave

Tiny data-over-sound library
https://youtu.be/Zcgf77T71QM
MIT License
1.9k stars 141 forks source link

Python 3.11 pip install ggwave fails. #89

Open denizsincar29 opened 1 year ago

denizsincar29 commented 1 year ago

Hello. I am trying to run my gui ggwaver in a new python, but pip install ggwave throws me an error. I tried to pip install it from setup.py, but no success.


pip install ggwave                                                                                       
Collecting ggwave                                                                                                       
  Using cached ggwave-0.4.2.tar.gz (76 kB)                                                                              
  Preparing metadata (setup.py) ... -                                                                                   
done
Installing collected packages: ggwave                                                                                   
  DEPRECATION: ggwave is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproje
ct.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement i
s to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559               
  Running setup.py install for ggwave ... -                                                                             
error
  error: subprocess-exited-with-error                                                                                   
  × Running setup.py install for ggwave did not run successfully.                                                       
  │ exit code: 1                                                                                                        
  ╰─> [22 lines of output]                                                                                              
      running install                                                                                                   
      C:\Users\dsinc\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.p
y install is deprecated. Use build and pip and other standards-based tools.                                             
        warnings.warn(                                                                                                  
      running build                                                                                                     
      running build_ext                                                                                                 
      building 'ggwave' extension                                                                                       
      creating build                                                                                                    
      creating build\temp.win-amd64-cpython-311                                                                         
      creating build\temp.win-amd64-cpython-311\Release                                                                 
      creating build\temp.win-amd64-cpython-311\Release\ggwave                                                          
      creating build\temp.win-amd64-cpython-311\Release\ggwave\src                                                      
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe" 
/c /nologo /O2 /W3 /GL /DNDEBUG /MD -Iggwave/include -Iggwave/include/ggwave -IC:\Users\dsinc\Python311\include -IC:\Use
rs\dsinc\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.33.31629\i
nclude" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (
x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.18362.0\\um" "-I
C:\Program Files (x86)\Windows Kits\10\\include\10.0.18362.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include
\10.0.18362.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.18362.0\\cppwinrt" /EHsc /Tpggwave.bycytho
n.cpp /Fobuild\temp.win-amd64-cpython-311\Release\ggwave.bycython.obj -O3 -std=c++11                                    
      cl : Command line warning D9002 : ignoring unknown option '-O3'                                                   
      cl : Command line warning D9002 : ignoring unknown option '-std=c++11'                                            
      ggwave.bycython.cpp                                                                                               
      ggwave/include/ggwave\ggwave.h(454): warning C4244: 'return': conversion from 'float' to 'int', possible loss of d
ata                                                                                                                     
      ggwave.bycython.cpp(2010): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data
      ggwave.bycython.cpp(2052): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data
      ggwave.bycython.cpp(2291): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data
      ggwave.bycython.cpp(5722): error C2027: use of undefined type '_frame'                                            
      C:\Users\dsinc\Python311\include\pytypedefs.h(22): note: see declaration of '_frame'                              
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.33.31629\\
bin\\HostX86\\x64\\cl.exe' failed with exit code 2                                                                      
      [end of output]                                                                                                   
  note: This error originates from a subprocess, and is likely not a problem with pip.                                  
error: legacy-install-failure                                                                                           
× Encountered error while trying to install package.                                                                    
╰─> ggwave                                                                                                              
note: This is an issue with the package mentioned above, not pip.                                                       
hint: See above for output from the failure.                                                                            
C:\Users\dsinc>                                                                                                         
JarbasAl commented 10 months ago

this is also failing for me on manjaro linux python 3.11, works with python 3.9

Collecting ggwave
  Using cached ggwave-0.4.2.tar.gz (76 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: ggwave
  Building wheel for ggwave (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'ggwave' extension
      creating build
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/ggwave
      creating build/temp.linux-x86_64-cpython-311/ggwave/src
      gcc -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -fPIC -Iggwave/include -Iggwave/include/ggwave -I/usr/include/python3.11 -c ggwave.bycython.cpp -o build/temp.linux-x86_64-cpython-311/ggwave.bycython.o -O3 -std=c++11
      ggwave.bycython.cpp: In function ‘void __Pyx_AddTraceback(const char*, int, int, const char*)’:
      ggwave.bycython.cpp:452:62: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
        452 |   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
            |                                                              ^~
      ggwave.bycython.cpp:5722:5: note: in expansion of macro ‘__Pyx_PyFrame_SetLineNumber’
       5722 |     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /usr/include/python3.11/Python.h:42,
                       from ggwave.bycython.cpp:6:
      /usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      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 ggwave
  Running setup.py clean for ggwave
Failed to build ggwave
ERROR: Could not build wheels for ggwave, which is required to install pyproject.toml-based projects
JarbasAl commented 10 months ago

working wheels here for now (only tested x86)

https://whl.smartgic.io/ggwave-0.4.2-cp311-cp311-linux_x86_64.whl

https://whl.smartgic.io/ggwave-0.4.2-cp311-cp311-linux_aarch64.whl (untested)

dorlow commented 4 months ago

You can fix this by adding the following line at the beginning of the file ggwave.bycython.cpp from the latest pip release. The error comes from a change in Python 3.11, as _frame struct was moved to an internal header, however the public API is primarily read-only. #include "internal/pycore_frame.h" Just download ggwave 0.4.2, do the modification, and pip install the setup.py