ahodges9 / LedFx

LedFx is a network based LED effect controller with support for advanced real-time audio effects! LedFx can control multiple devices and works great with cheap ESP8266 nodes allowing for cost effectvice syncronized effects across your entire house!
MIT License
384 stars 91 forks source link

Problem with pyaudio (Windows 10) #162

Open GACGAMA opened 3 years ago

GACGAMA commented 3 years ago

Hello Everyone!

I'm trying to install LedFx on my windows 10 machine.

I installed the latest python, then the latest Anaconda (py 3.8), and all Visual Studio codes for pyaudio.

After trying to use pip install ledfx in my virtual env, I'm getting a lot of error codes:

Building wheel for pyaudio (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\avela\.conda\envs\ledfx\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\avela\\AppData\\Local\\Temp\\pip-install-ah_6mpvw\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\avela\\AppData\\Local\\Temp\\pip-install-ah_6mpvw\\pyaudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\avela\AppData\Local\Temp\pip-wheel-n3au19tk'
       cwd: C:\Users\avela\AppData\Local\Temp\pip-install-ah_6mpvw\pyaudio\
  Complete output (58 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  copying src\pyaudio.py -> build\lib.win-amd64-3.9
  running build_ext
  building '_portaudio' extension
  creating build\temp.win-amd64-3.9
  creating build\temp.win-amd64-3.9\Release
  creating build\temp.win-amd64-3.9\Release\src
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -IC:\Users\avela\.conda\envs\ledfx\include -IC:\Users\avela\.conda\envs\ledfx\include -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE -IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt -IC:\Program Files (x86)\Windows Kits\8.1\include\shared -IC:\Program Files (x86)\Windows Kits\8.1\include\um -IC:\Program Files (x86)\Windows Kits\8.1\include\winrt /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.9\Release\src/_portaudiomodule.obj
  _portaudiomodule.c
  c:\users\avela\.conda\envs\ledfx\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
  c:\users\avela\.conda\envs\ledfx\include\pyconfig.h(117): note: command-line arguments:  see previous definition of 'MS_WIN64'
  src/_portaudiomodule.c(44): warning C4005: 'min': macro redefinition
  C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdlib.h(1283): note: see previous definition of 'min'
  src/_portaudiomodule.c(1367): error C2059: syntax error: '{'
  src/_portaudiomodule.c(1367): warning C4013: '__typeof__' undefined; assuming extern returning int
  src/_portaudiomodule.c(1367): error C2146: syntax error: missing ';' before identifier '_b'
  src/_portaudiomodule.c(1367): error C2065: '_b': undeclared identifier
  src/_portaudiomodule.c(1367): error C2065: '_a': undeclared identifier
  src/_portaudiomodule.c(1367): error C2059: syntax error: ')'
  src/_portaudiomodule.c(1371): error C2065: 'output_data': undeclared identifier
  src/_portaudiomodule.c(1371): warning C4022: 'memset': pointer mismatch for actual parameter 1
  src/_portaudiomodule.c(1376): error C2143: syntax error: missing ')' before '('
  src/_portaudiomodule.c(1376): error C2091: function returns function
  src/_portaudiomodule.c(1376): error C2059: syntax error: ')'
  src/_portaudiomodule.c(1376): error C2143: syntax error: missing ')' before ';'
  src/_portaudiomodule.c(1376): error C2373: '_Py_DECREF': redefinition; different type modifiers
  c:\users\avela\.conda\envs\ledfx\include\object.h(413): note: see declaration of '_Py_DECREF'
  src/_portaudiomodule.c(1378): error C2143: syntax error: missing '{' before ':'
  src/_portaudiomodule.c(1378): error C2059: syntax error: ':'
  src/_portaudiomodule.c(1385): error C2143: syntax error: missing ')' before '('
  src/_portaudiomodule.c(1385): error C2091: function returns function
  src/_portaudiomodule.c(1385): error C2059: syntax error: ')'
  src/_portaudiomodule.c(1385): error C2143: syntax error: missing ')' before ';'
  src/_portaudiomodule.c(1385): error C2373: '_Py_XDECREF': redefinition; different type modifiers
  c:\users\avela\.conda\envs\ledfx\include\object.h(494): note: see declaration of '_Py_XDECREF'
  src/_portaudiomodule.c(1386): error C2143: syntax error: missing ')' before '('
  src/_portaudiomodule.c(1386): error C2091: function returns function
  src/_portaudiomodule.c(1386): error C2059: syntax error: ')'
  src/_portaudiomodule.c(1386): error C2143: syntax error: missing ')' before ';'
  src/_portaudiomodule.c(1386): error C2373: '_Py_XDECREF': redefinition; different type modifiers
  c:\users\avela\.conda\envs\ledfx\include\object.h(494): note: see declaration of '_Py_XDECREF'
  src/_portaudiomodule.c(1387): error C2143: syntax error: missing ')' before '('
  src/_portaudiomodule.c(1387): error C2091: function returns function
  src/_portaudiomodule.c(1387): error C2059: syntax error: ')'
  src/_portaudiomodule.c(1387): error C2143: syntax error: missing ')' before ';'
  src/_portaudiomodule.c(1387): error C2373: '_Py_XDECREF': redefinition; different type modifiers
  c:\users\avela\.conda\envs\ledfx\include\object.h(494): note: see declaration of '_Py_XDECREF'
  src/_portaudiomodule.c(1389): error C2371: 'PyGILState_Release': redefinition; different basic types
  c:\users\avela\.conda\envs\ledfx\include\pystate.h(130): note: see declaration of 'PyGILState_Release'
  src/_portaudiomodule.c(1390): error C2059: syntax error: 'return'
  src/_portaudiomodule.c(1391): error C2059: syntax error: '}'
  src/_portaudiomodule.c(2278): warning C4996: 'PyEval_InitThreads': deprecated in 3.9
  c:\users\avela\.conda\envs\ledfx\include\ceval.h(130): note: see declaration of 'PyEval_InitThreads'
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
  ----------------------------------------
  ERROR: Failed building wheel for pyaudio

Then


Installing collected packages: chardet, multidict, idna, yarl, attrs, async-timeout, aiohttp, MarkupSafe, jinja2, aiohttp-jinja2, urllib3, requests, pyyaml, pypiwin32, voluptuous, sacn, pyaudio, ledfx
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\avela\.conda\envs\ledfx\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\avela\\AppData\\Local\\Temp\\pip-install-ah_6mpvw\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\avela\\AppData\\Local\\Temp\\pip-install-ah_6mpvw\\pyaudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\avela\AppData\Local\Temp\pip-record-2nik1rj4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\avela\.conda\envs\ledfx\Include\pyaudio'
         cwd: C:\Users\avela\AppData\Local\Temp\pip-install-ah_6mpvw\pyaudio\
    Complete output (58 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    copying src\pyaudio.py -> build\lib.win-amd64-3.9
    running build_ext
    building '_portaudio' extension
    creating build\temp.win-amd64-3.9
    creating build\temp.win-amd64-3.9\Release
    creating build\temp.win-amd64-3.9\Release\src
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -IC:\Users\avela\.conda\envs\ledfx\include -IC:\Users\avela\.conda\envs\ledfx\include -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE -IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt -IC:\Program Files (x86)\Windows Kits\8.1\include\shared -IC:\Program Files (x86)\Windows Kits\8.1\include\um -IC:\Program Files (x86)\Windows Kits\8.1\include\winrt /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.9\Release\src/_portaudiomodule.obj
    _portaudiomodule.c
    c:\users\avela\.conda\envs\ledfx\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
    c:\users\avela\.conda\envs\ledfx\include\pyconfig.h(117): note: command-line arguments:  see previous definition of 'MS_WIN64'
    src/_portaudiomodule.c(44): warning C4005: 'min': macro redefinition
    C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdlib.h(1283): note: see previous definition of 'min'
    src/_portaudiomodule.c(1367): error C2059: syntax error: '{'
    src/_portaudiomodule.c(1367): warning C4013: '__typeof__' undefined; assuming extern returning int
    src/_portaudiomodule.c(1367): error C2146: syntax error: missing ';' before identifier '_b'
    src/_portaudiomodule.c(1367): error C2065: '_b': undeclared identifier
    src/_portaudiomodule.c(1367): error C2065: '_a': undeclared identifier
    src/_portaudiomodule.c(1367): error C2059: syntax error: ')'
    src/_portaudiomodule.c(1371): error C2065: 'output_data': undeclared identifier
    src/_portaudiomodule.c(1371): warning C4022: 'memset': pointer mismatch for actual parameter 1
    src/_portaudiomodule.c(1376): error C2143: syntax error: missing ')' before '('
    src/_portaudiomodule.c(1376): error C2091: function returns function
    src/_portaudiomodule.c(1376): error C2059: syntax error: ')'
    src/_portaudiomodule.c(1376): error C2143: syntax error: missing ')' before ';'
    src/_portaudiomodule.c(1376): error C2373: '_Py_DECREF': redefinition; different type modifiers
    c:\users\avela\.conda\envs\ledfx\include\object.h(413): note: see declaration of '_Py_DECREF'
    src/_portaudiomodule.c(1378): error C2143: syntax error: missing '{' before ':'
    src/_portaudiomodule.c(1378): error C2059: syntax error: ':'
    src/_portaudiomodule.c(1385): error C2143: syntax error: missing ')' before '('
    src/_portaudiomodule.c(1385): error C2091: function returns function
    src/_portaudiomodule.c(1385): error C2059: syntax error: ')'
    src/_portaudiomodule.c(1385): error C2143: syntax error: missing ')' before ';'
    src/_portaudiomodule.c(1385): error C2373: '_Py_XDECREF': redefinition; different type modifiers
    c:\users\avela\.conda\envs\ledfx\include\object.h(494): note: see declaration of '_Py_XDECREF'
    src/_portaudiomodule.c(1386): error C2143: syntax error: missing ')' before '('
    src/_portaudiomodule.c(1386): error C2091: function returns function
    src/_portaudiomodule.c(1386): error C2059: syntax error: ')'
    src/_portaudiomodule.c(1386): error C2143: syntax error: missing ')' before ';'
    src/_portaudiomodule.c(1386): error C2373: '_Py_XDECREF': redefinition; different type modifiers
    c:\users\avela\.conda\envs\ledfx\include\object.h(494): note: see declaration of '_Py_XDECREF'
    src/_portaudiomodule.c(1387): error C2143: syntax error: missing ')' before '('
    src/_portaudiomodule.c(1387): error C2091: function returns function
    src/_portaudiomodule.c(1387): error C2059: syntax error: ')'
    src/_portaudiomodule.c(1387): error C2143: syntax error: missing ')' before ';'
    src/_portaudiomodule.c(1387): error C2373: '_Py_XDECREF': redefinition; different type modifiers
    c:\users\avela\.conda\envs\ledfx\include\object.h(494): note: see declaration of '_Py_XDECREF'
    src/_portaudiomodule.c(1389): error C2371: 'PyGILState_Release': redefinition; different basic types
    c:\users\avela\.conda\envs\ledfx\include\pystate.h(130): note: see declaration of 'PyGILState_Release'
    src/_portaudiomodule.c(1390): error C2059: syntax error: 'return'
    src/_portaudiomodule.c(1391): error C2059: syntax error: '}'
    src/_portaudiomodule.c(2278): warning C4996: 'PyEval_InitThreads': deprecated in 3.9
    c:\users\avela\.conda\envs\ledfx\include\ceval.h(130): note: see declaration of 'PyEval_InitThreads'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\avela\.conda\envs\ledfx\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\avela\\AppData\\Local\\Temp\\pip-install-ah_6mpvw\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\avela\\AppData\\Local\\Temp\\pip-install-ah_6mpvw\\pyaudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\avela\AppData\Local\Temp\pip-record-2nik1rj4\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\avela\.conda\envs\ledfx\Include\pyaudio' Check the logs for full command output.

I've seen other people with a similar problem with other packages such as scrappy, with varied solutions.

Any ideas?

GACGAMA commented 3 years ago

I got it to work by using Python 3.6.11: Substitute conda create -n ledfx to conda create -n ledfx python=3.6

Can't make it work with python 3.7 though.

TomCasavant commented 3 years ago

I believe the issue is with pyaudio. I fixed this problem the other day by using pipwin to install pyaudio binary files:

pip install pipwin

pipwin install pyaudio