PyAudio and Speech Recognition not working - python

When I try to run speech_recognition, this happens:
C:\Users\CHERRY\WebOpener>python -m speech_recognition
Traceback (most recent call last):
File "C:\Users\CHERRY\WebOpener\venv\lib\site-packages\speech_recognition\__init__.py", line 108, in get_pyaudio
import pyaudio
ModuleNotFoundError: No module named 'pyaudio'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\CHERRY\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\CHERRY\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\CHERRY\WebOpener\venv\lib\site-packages\speech_recognition\__main__.py", line 4, in <module>
m = sr.Microphone()
File "C:\Users\CHERRY\WebOpener\venv\lib\site-packages\speech_recognition\__init__.py", line 79, in __init__
self.pyaudio_module = self.get_pyaudio()
File "C:\Users\CHERRY\WebOpener\venv\lib\site-packages\speech_recognition\__init__.py", line 110, in get_pyaudio
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
But when I try to install PyAudio from the pipwin method
pip install pipwin
pipwin install pyaudio
this happens:
C:\Users\CHERRY\WebOpener>pipwin install pyaudio
Package `pyaudio` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/q4trcu4l/PyAudio-0.2.11-cp39-cp39-win_amd64.whl
PyAudio-0.2.11-cp39-cp39-win_amd64.whl
Traceback (most recent call last):
File "C:\Users\CHERRY\WebOpener\venv\Scripts\pipwin-script.py", line 33, in <module>
sys.exit(load_entry_point('pipwin==0.5.1', 'console_scripts', 'pipwin')())
File "c:\users\cherry\webopener\venv\lib\site-packages\pipwin\command.py", line 103, in main
cache.install(package)
File "c:\users\cherry\webopener\venv\lib\site-packages\pipwin\pipwin.py", line 300, in install
wheel_file = self.download(requirement)
File "c:\users\cherry\webopener\venv\lib\site-packages\pipwin\pipwin.py", line 294, in download
return self._download(requirement, dest)
File "c:\users\cherry\webopener\venv\lib\site-packages\pipwin\pipwin.py", line 290, in _download
obj.start()
File "c:\users\cherry\webopener\venv\lib\site-packages\pySmartDL\pySmartDL.py", line 267, in start
urlObj = urllib.request.urlopen(req, timeout=self.timeout, context=self.context)
File "C:\Users\CHERRY\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\CHERRY\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open
response = meth(req, response)
File "C:\Users\CHERRY\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response
response = self.parent.error(
File "C:\Users\CHERRY\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 561, in error
return self._call_chain(*args)
File "C:\Users\CHERRY\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Users\CHERRY\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 641, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
I don't understand. PyAudio used to download from the pipwin method. But it is not downloading. Is there another method for downloading PyAudio?
Thanks.

I had the same problem as you. I used
python -m pipwin install pyaudio

Related

Python, can not install pyaudio

I'm trying to install pyaudio in 3 ways but failed:
Solution 1
pip install pyaudio
of course, it's not working but worth a try.
Solution 2
pip install pipwin
pipwin install pyaudio
and this is what I got:
Traceback (most recent call last):
File "C:\Users\Admin\python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Admin\python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Admin\virtualenv\ErzaProject\Scripts\pipwin.exe\__main__.py", line 7, in <module>
File "C:\Users\Admin\virtualenv\ErzaProject\lib\site-packages\pipwin\command.py", line 98, in main
cache.install(package)
File "C:\Users\Admin\virtualenv\ErzaProject\lib\site-packages\pipwin\pipwin.py", line 300, in install
wheel_file = self.download(requirement)
File "C:\Users\Admin\virtualenv\ErzaProject\lib\site-packages\pipwin\pipwin.py", line 294, in download
return self._download(requirement, dest)
File "C:\Users\Admin\virtualenv\ErzaProject\lib\site-packages\pipwin\pipwin.py", line 290, in _download
obj.start()
File "C:\Users\Admin\virtualenv\ErzaProject\lib\site-packages\pySmartDL\pySmartDL.py", line 267, in start
urlObj = urllib.request.urlopen(req, timeout=self.timeout, context=self.context)
File "C:\Users\Admin\python\Python37\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Admin\python\Python37\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\Users\Admin\python\Python37\lib\urllib\request.py", line 543, in _open
'_open', req)
File "C:\Users\Admin\python\Python37\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Users\Admin\python\Python37\lib\urllib\request.py", line 1360, in https_open
context=self._context, check_hostname=self._check_hostname)
File "C:\Users\Admin\python\Python37\lib\urllib\request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error timed out>
Solution 3
pip install PyAudio-0.2.11-cp36-cp36m-win_amd64.whl
and the result:
WARNING: Requirement 'PyAudio-0.2.11-cp36-cp36m-win_amd64.whl' looks like a filename, but the file does not exist
ERROR: PyAudio-0.2.11-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
I even go to this page directly and got “ERR_CONNECTION_TIMED_OUT” error when clicking on the file.
I just wonder if there is any problem with the main page? Or it's because of my system? And any way to install pyaudio?
(I'm currently on win10 64bit)
Looking at the pypi files page for PyAudio, the latest wheels are for Python 3.6.
From your traceback it seems like you are running Python 3.7, so that won't work. The link on the pythonlibs page also times out for me.
If pip cannot find a suitable wheel, it will try to compile the package using its setup.py.
Nothing for it but to set up a development environment and compile it yourself. This link might help with that.

Not able to install pyaudio python module

I can't install Pyaudio in my python 3.10.1. using pip install pipwin then pipwin install pyaudio.
Error:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>pipwin install pyaudio
Package `pyaudio` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/y2rycu7g/PyAudio-0.2.11-cp310-cp310-win_amd64.whl
PyAudio-0.2.11-cp310-cp310-win_amd64.whl
Traceback (most recent call last):
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\Scripts\pipwin.exe\__main__.py", line 7, in <module>
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\site-packages\pipwin\command.py", line 103, in main
cache.install(package)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\site-packages\pipwin\pipwin.py", line 300, in install
wheel_file = self.download(requirement)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\site-packages\pipwin\pipwin.py", line 294, in download
return self._download(requirement, dest)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\site-packages\pipwin\pipwin.py", line 290, in _download
obj.start()
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\site-packages\pySmartDL\pySmartDL.py", line 267, in start
urlObj = urllib.request.urlopen(req, timeout=self.timeout, context=self.context)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 525, in open
response = meth(req, response)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 634, in http_response
response = self.parent.error(
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 563, in error
return self._call_chain(*args)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
result = func(*args)
File "C:\Users\ayamk\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 643, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
You are getting urllib.error.HTTPError: HTTP Error 404: Not Found
the .whl for pyaudio is not available at the URL pipwin is trying to download it from
Try doing pipwin refresh before doing the installation
see this github issue
Alternatively,
You can download the .whl directly from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
and do
pip install <path-to-downloaded-whl>

Failed installing pylint via cmd (Windows)

As the title says, I'm trying to install pylint with the below command:
pip install pylint
But I get the below exception:
Exception:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2482, in _dep_map
return self.__dep_map
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2344, in __getattr__
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python34\lib\site-packages\pip\req.py", line 1265, in prepare_files
req_to_install.extras):
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2291, in requires
dm = self._dep_map
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2484, in _dep_map
self.__dep_map = self._compute_dependencies()
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2508, in _compute_dependencies
parsed = next(parse_requirements(distvers))
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2605, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "C:\Python34\lib\site-packages\pip\_vendor\pkg_resources.py", line 2583, in scan_list
"Expected ',' or end-of-list in",line,"at",line[p:]
ValueError: ("Expected ',' or end-of-list in", 'lazy-object-proxy ==1.4.*', 'at', '*')
Storing debug log for failure in C:\Users\Haiss\pip\pip.log
Anybody have any ideas what's causing it to fail? I have Python 3 installed using Anaconda. I checked the debug log but it doesn't provide any additional details.
try this:
easy_install --upgrade pip

'pipenv install' fails with TypeError: must be str, not type

Here's the full error log -
C:\Dev\libpython\src>pipenv install
Creating a virtualenv for this project…
Pipfile: C:\Dev\libpython\src\Pipfile
Using C:/Python/Python36-64/python.exe (3.6.6) to create virtualenv…
Running virtualenv with interpreter C:/Python/Python36-64/python.exe
Using base prefix 'C:\\Python\\Python36-64'
New python executable in C:\Users\Pulkit\.virtualenvs\src-PtwTDfFP\Scripts\python.exe
Cannot find a wheel for pip
Installing setuptools, pip, wheel...
Complete output from command C:\Users\Pulkit\.vir...P\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 8, in <module>
ModuleNotFoundError: No module named 'pip'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 11, in <module>
ModuleNotFoundError: No module named 'pip'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "c:\python\python36-64\lib\site-packages\virtualenv.py", line 2343, in <module>
main()
File "c:\python\python36-64\lib\site-packages\virtualenv.py", line 712, in main
symlink=options.symlink)
File "c:\python\python36-64\lib\site-packages\virtualenv.py", line 947, in create_environment
download=download,
File "c:\python\python36-64\lib\site-packages\virtualenv.py", line 904, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "c:\python\python36-64\lib\site-packages\virtualenv.py", line 796, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command C:\Users\Pulkit\.vir...P\Scripts\python.exe - setuptools pip wheel failed with error code 1
Traceback (most recent call last):
File "c:\python\python36-64\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python\python36-64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python\Python36-64\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\python\python36-64\lib\site-packages\pipenv\cli\command.py", line 249, in install
editable_packages=state.installstate.editables,
File "c:\python\python36-64\lib\site-packages\pipenv\core.py", line 1724, in do_install
pypi_mirror=pypi_mirror,
File "c:\python\python36-64\lib\site-packages\pipenv\core.py", line 565, in ensure_project
pypi_mirror=pypi_mirror,
File "c:\python\python36-64\lib\site-packages\pipenv\core.py", line 500, in ensure_virtualenv
python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
File "c:\python\python36-64\lib\site-packages\pipenv\core.py", line 901, in do_create_virtualenv
click.echo(crayons.blue("{0}".format(c.err)), err=True)
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\delegator.py", line 146, in err
return self._pexpect_out
File "c:\python\python36-64\lib\site-packages\pipenv\vendor\delegator.py", line 114, in _pexpect_out
result += self.subprocess.after
TypeError: must be str, not type
I have tried downgrading pip from (18.1 to 9.0.1) and also downgrading pipenv, it did not resolve the issue.
This stupid policy keeps telling to add more details, hence everything after this is only a filler.
I was so happy to publish my first package in pypa but then this stupid issue happened. I have wasted a lot of time already.
Manged to fix the issue temporarily by downgrading virtualenv -
pip install virtualenv==15.* --upgrade

Installing distribute for Python 3.3

I try to install distribute with python 3.3 on Ubuntu 12.04 to install pymongo.
I downloaded distribute_setup.py with
curl -O http://python-distribute.org/distribute_setup.py
Afterwards I tried
python3 distribute_setup.py install
But I recive
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
Traceback (most recent call last):
File "distribute_setup.py", line 556, in <module>
sys.exit(main())
File "distribute_setup.py", line 552, in main
tarball = download_setuptools(download_base=options.download_base)
File "distribute_setup.py", line 211, in download_setuptools
src = urlopen(url)
File "/usr/local/lib/python3.3/urllib/request.py", line 156, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.3/urllib/request.py", line 475, in open
response = meth(req, response)
File "/usr/local/lib/python3.3/urllib/request.py", line 587, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/lib/python3.3/urllib/request.py", line 507, in error
result = self._call_chain(*args)
File "/usr/local/lib/python3.3/urllib/request.py", line 447, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.3/urllib/request.py", line 692, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/local/lib/python3.3/urllib/request.py", line 469, in open
response = self._open(req, data)
File "/usr/local/lib/python3.3/urllib/request.py", line 492, in _open
'unknown_open', req)
File "/usr/local/lib/python3.3/urllib/request.py", line 447, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.3/urllib/request.py", line 1310, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: https>
Can someone please help me? It seems as if distribute uses code, that does not compile with python 3.3..
I installed Python 3.3.2 in my homefolder following these steps:
./configure
make
make test
sudo make install
If I try to install pymongo from source I recive:
Extracting in /tmp/tmpth91z4
Traceback (most recent call last):
File "setup.py", line 22, in <module>
from setuptools import setup, Feature
ImportError: No module named 'setuptools'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dev/pymongo/ez_setup.py", line 130, in use_setuptools
import pkg_resources
ImportError: No module named 'pkg_resources'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 25, in <module>
use_setuptools()
File "/home/dev/pymongo/ez_setup.py", line 132, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/home/dev/pymongo/ez_setup.py", line 111, in _do_download
_build_egg(egg, tarball, to_dir)
File "/home/dev/pymongo/ez_setup.py", line 83, in _build_egg
tar = tarfile.open(tarball)
File "/usr/local/lib/python3.3/tarfile.py", line 1571, in open
raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully
Thank you
Are you sure you installed openssl-devel before compiling Python? I have had the same issue, however I fixed it by previously installing openssl-devel and then compiling Python 3 + distribute.

Categories