pyaudio - legacy-install-failure - python

Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
error: subprocess-exited-with-error
× Running setup.py install for pyaudio did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.10
copying src/pyaudio.py -> build/lib.macosx-10.9-universal2-3.10
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-universal2-3.10/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[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.
╰─> pyaudio
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Hey this question was already asked : PyAudio error at the time of intallation (subprocess-exited-with-error)
You need to download the wheel (.whl) file on the website quoted in the answer (https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio).
And then, you install it using pip install filename.whl using the cmd in the directory where you downloaded the file in .whl .

Related

error when I am trying to install pyaudio on Mac OS Ventura

I know this questions was asked couple of times, but all the answers do not work for me.
I get this error when I try to install PyAudio:
Building wheels for collected packages: pyaudio
WARNING: Ignoring --global-option when building pyaudio using PEP 517
Building wheel for pyaudio (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyaudio (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-cpython-39
copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-cpython-39
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-x86_64-cpython-39
creating build/temp.macosx-10.9-x86_64-cpython-39/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/usr/local/include -I/usr/include -I/Users/myname/PycharmProjects/a/venv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/_portaudiomodule.o
src/_portaudiomodule.c:31:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
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 pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
From what I can tell, it's ignoring the global portaudio and looking for another one ?
I removed and installed already portaudio with brew, I update everything, I installed command line for Xcode, I tried with anaconda in notebook, same error there as well. I already tried to installed wheel and said its fulfilled.
Where to put this portaudio file so it see it ?
Any suggestions to fix this error ?
Thanks

Can't find `lz4` header when installing `roslz4` with pip on a Mac

I'm trying to install roslz4 on my Mac, and I get the following error.
In file included from ros_comm/utilities/roslz4/src/_roslz4module.c:37:
include/roslz4/lz4s.h:38:10: fatal error: 'lz4.h' file not found
#include <lz4.h>
^~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
[end of output]
To counter this, I installed lz4 with brew which ran successfully
> brew install lz4
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/manifests/1.9.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/blobs/sha256:d222923849a6fefd391ab6705f1468c10d287c08ab9c4b5053a18a552139e262
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:d222923849a6fefd391ab6705f1468c10d287c08ab9c4b5053a18a552139e262?se=2022-06-14T22%3A20%3A00Z&s
######################################################################## 100.0%
==> Pouring lz4--1.9.3.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/lz4/1.9.3: 22 files, 620.6KB
==> Running `brew cleanup lz4`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
However, it does not appear to have resolved the problem.
Full pip output:
> pip install --extra-index-url https://rospypi.github.io/simple/ roslz4
Looking in indexes: https://pypi.org/simple, https://rospypi.github.io/simple/
Collecting roslz4
Using cached https://github.com/rospypi/simple/raw/any/roslz4/roslz4-1.14.3.post2.tar.gz (18 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: roslz4
Building wheel for roslz4 (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-arm64-3.8
creating build/lib.macosx-10.14-arm64-3.8/roslz4
copying ros_comm/utilities/roslz4/src/roslz4/__init__.py -> build/lib.macosx-10.14-arm64-3.8/roslz4
running build_ext
building '_roslz4' extension
creating build/temp.macosx-10.14-arm64-3.8
creating build/temp.macosx-10.14-arm64-3.8/ros_comm
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DXXH_NAMESPACE=ROSLZ4_ -Iinclude -Iroscpp_core/cpp_common/include -I/Users/cmauceri/Workspace/run-mgmt/jupyter_venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c ros_comm/utilities/roslz4/src/_roslz4module.c -o build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4/src/_roslz4module.o -Wno-strict-prototypes -Wno-missing-field-initializers -Wno-unused-variable -Wno-strict-aliasing
In file included from ros_comm/utilities/roslz4/src/_roslz4module.c:37:
include/roslz4/lz4s.h:38:10: fatal error: 'lz4.h' file not found
#include <lz4.h>
^~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for roslz4
Running setup.py clean for roslz4
Failed to build roslz4
Installing collected packages: roslz4
Running setup.py install for roslz4 ... error
error: subprocess-exited-with-error
× Running setup.py install for roslz4 did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-arm64-3.8
creating build/lib.macosx-10.14-arm64-3.8/roslz4
copying ros_comm/utilities/roslz4/src/roslz4/__init__.py -> build/lib.macosx-10.14-arm64-3.8/roslz4
running build_ext
building '_roslz4' extension
creating build/temp.macosx-10.14-arm64-3.8
creating build/temp.macosx-10.14-arm64-3.8/ros_comm
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DXXH_NAMESPACE=ROSLZ4_ -Iinclude -Iroscpp_core/cpp_common/include -I/Users/cmauceri/Workspace/run-mgmt/jupyter_venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c ros_comm/utilities/roslz4/src/_roslz4module.c -o build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4/src/_roslz4module.o -Wno-strict-prototypes -Wno-missing-field-initializers -Wno-unused-variable -Wno-strict-aliasing
In file included from ros_comm/utilities/roslz4/src/_roslz4module.c:37:
include/roslz4/lz4s.h:38:10: fatal error: 'lz4.h' file not found
#include <lz4.h>
^~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
[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.
╰─> roslz4
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Do I need to add the location of lz4 headers to an environment variable? How can I get pip to find the header?
After doing brew install lz4 the following (from this SO post by rgov) worked for me without the need of any source code changes:
CFLAGS="-I$(brew --prefix lz4)/include" \
LDFLAGS="-L$(brew --prefix lz4)/lib" \
pip install roslz4 --extra-index-url https://rospypi.github.io/simple/
Answer from a coworker:
My solution was to download the roslz4 tarball and manually add the include folders and library symbols into the setup config, then run python setup.py install
Here are the first few lines of my setup.py file (which includes my addition to include and lib)
import platform
from setuptools import setup, Extension
extra_compile_args = []
include_dirs = [
"include",
"roscpp_core/cpp_common/include",
"/usr/local/Cellar/lz4/1.9.3/include",
]
libraries = ["lz4"]
library_dirs = ["/usr/local/Cellar/lz4/1.9.3/lib"]
define_macros = [
("XXH_NAMESPACE", "ROSLZ4_"),
]
My changes are the lines with "Cellar" and "library_dirs"

why is my speech recognition not working in python

I am working on this project and its simply a desktop Assistant I am using speech recognition and pyttsx3 but the speech recognition is not working after the try nothing is executing it just jumps to except and passes can someone tell me why? and how I can fix it
edit: I tried to install pyaudio but it won't let me I keep getting errors
Defaulting to user installation because normal site-packages is not writeable
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.10
copying src/pyaudio.py -> build/lib.macosx-10.9-universal2-3.10
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-universal2-3.10/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' 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 pyaudio
Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
error: subprocess-exited-with-error
× Running setup.py install for pyaudio did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-3.10
copying src/pyaudio.py -> build/lib.macosx-10.9-universal2-3.10
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-universal2-3.10/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[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.
╰─> pyaudio
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure. ```
import speech_recognition as sr
import pyttsx3
listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
def talk(text):
engine.say(text)
engine.runAndWait()
talk("i am your alexa, what can i do for you")
try:
with sr.microphone() as source:
print('listening...')
voice = listener.listen(source)
command = listener.recognize_google(voice)
command = command.lower()
if 'alexa' in command:
engine.say(command)
engine.runAndWait()
print(command)
except:
pass
PyAudio requires PortAudio be installed on your system. Check out the Installation section of the PyAudio documentation.
For Mac OS, the following should do the trick:
brew install portaudio
pip install pyaudio
There are probably other acceptable ways to install PortAudio too if you're not already using Homebrew.
brew install portaudio
pip install pyaudio

How can I solve openexr install error in Ubuntu?

I'm try to install openexr in ubuntu with pip install openexr. But it's not work. Also I tried to install with .whl file, but error is returned.
ERROR: OpenEXR-1.3.7-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.
How can I solve this problem?
Python : 3.9.5
Ubuntu : 21.04
pip : 22.0.4
Error log:
Collecting openexr
Using cached OpenEXR-1.3.7.tar.gz (11 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: openexr
Building wheel for openexr (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
Looking for libOpenEXR...
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
copying Imath.py -> build/lib.linux-x86_64-3.9
running build_ext
building 'OpenEXR' extension
creating build/temp.linux-x86_64-3.9
clang-9 -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/opt/local/include/OpenEXR -I/usr/include/Imath -I/usr/local/include/Imath -I/opt/local/include/Imath -I/home/donghyuk/repo/2022_pm_research/PC-Differentiable/venv/include -I/usr/include/python3.9 -c OpenEXR.cpp -o build/temp.linux-x86_64-3.9/OpenEXR.o -g -DVERSION=\"1.3.7\"
clang: error: unknown argument: '-ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=.'
error: command '/usr/bin/clang-9' 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 openexr
Running setup.py clean for openexr
Failed to build openexr
Installing collected packages: openexr
Running setup.py install for openexr ... error
error: subprocess-exited-with-error
× Running setup.py install for openexr did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
Looking for libOpenEXR...
running install
/home/donghyuk/repo/2022_pm_research/PC-Differentiable/venv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
copying Imath.py -> build/lib.linux-x86_64-3.9
running build_ext
building 'OpenEXR' extension
creating build/temp.linux-x86_64-3.9
clang-9 -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR -I/opt/local/include/OpenEXR -I/usr/include/Imath -I/usr/local/include/Imath -I/opt/local/include/Imath -I/home/donghyuk/repo/2022_pm_research/PC-Differentiable/venv/include -I/usr/include/python3.9 -c OpenEXR.cpp -o build/temp.linux-x86_64-3.9/OpenEXR.o -g -DVERSION=\"1.3.7\"
clang: error: unknown argument: '-ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=.'
error: command '/usr/bin/clang-9' failed with exit code 1
[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.
╰─> openexr
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
The option ffile-prefix-map which is used in the compilation here is only available in clang starting with version 10, see here. You seem to have clang-9, so simply get a newer version:
sudo apt install clang-11
Additional Note: Your whl is for windows, as marked by the tag win_amd64 whcih is why it won't install to your ubuntu system

Export python output to password protected zip file?

I'm on the last step of a program that I have been creating. I have to export the output of my python program as a password protected zip file (I have been following these instructions). I was looking to use the pyminizip package to do so, but it will not install on my mac. The following error message appears in my terminal:
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
running bdist_wheel
running build
running build_ext
building 'pyminizip' extension
creating build
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/src
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11/contrib
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11/contrib/minizip
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Isrc -Izlib-1.2.11 -Izlib-1.2.11/contrib/minizip -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/py_miniunz.c -o build/temp.macosx-10.9-universal2-3.10/src/py_miniunz.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/clang' 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 pyminizip
Running setup.py clean for pyminizip
Failed to build pyminizip
Installing collected packages: pyminizip
Running setup.py install for pyminizip ... error
error: subprocess-exited-with-error
× Running setup.py install for pyminizip did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
running install
running build
running build_ext
building 'pyminizip' extension
creating build
creating build/temp.macosx-10.9-universal2-3.10
creating build/temp.macosx-10.9-universal2-3.10/src
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11/contrib
creating build/temp.macosx-10.9-universal2-3.10/zlib-1.2.11/contrib/minizip
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Isrc -Izlib-1.2.11 -Izlib-1.2.11/contrib/minizip -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/py_miniunz.c -o build/temp.macosx-10.9-universal2-3.10/src/py_miniunz.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/clang' failed with exit code 1
[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.
╰─> pyminizip
Having no clue how to even deal with packages, I am a bit confused in terms of how to approach the issue. Is this because I have a mac, and if so, what other approach could I take to export my list as a password protected zip file?
This problem was simply solved by creating a virtual environment in vscode.

Categories

Resources