I install pyaudio many times But not working? ERROR: Cannot uninstall 'PyAudio' - module

ModuleNotFoundError: No module named 'pyaudio'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\Omkar_Bhatuse\Downloads\VoiceBot\Voice_bot.py", line 15, in
with sr.Microphone() as source:
File "C:\Users\Omkar_Bhatuse\Downloads\VoiceBot\venv\lib\site-packages\speech_recognition_init_.py", line 79, in init
self.pyaudio_module = self.get_pyaudio()
File "C:\Users\Omkar_Bhatuse\Downloads\VoiceBot\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
(venv) PS C:\Users\Omkar_Bhatuse\Downloads\VoiceBot>

install it using command prompt then try to use the package from the site-packages folder in the python interrupter

Related

No Module Named "requests" even though I installed it already in pycharm

This is the error i get from command prompt:
Traceback (most recent call last):
File "C:\Users\12103\PycharmProjects\pythonProject1\googlesearch.py", line 9, in
import requests
ModuleNotFoundError: No module named 'requests'
i read somewhere saying it might be the environment or something? help would be great thanks

Can't build spark py-files with pandas included

I am attempting to package up my dependencies for a spark program I am creating. I have a requirements.txt file as below
pandas
I then run
pip3 install -t dependencies -r requirements.txt
cd dependencies
zip -r ../dependencies.zip .
pyspark --py-files dependencies.zip
And run the line -
import pandas
And I get the error -
Traceback (most recent call last):
File "/mnt/tmp/spark-REDACTED/userFiles-REDACTED/dependencies.zip/pandas/__init__.py", line 31, in <module>
File "/mnt/tmp/spark-REDACTED/userFiles-REDACTED/dependencies.zip/pandas/_libs/__init__.py", line 3, in <module>
File "/mnt/tmp/spark-REDACTED/userFiles-REDACTED/dependencies.zip/pandas/_libs/tslibs/__init__.py", line 3, in <module>
ModuleNotFoundError: No module named 'pandas._libs.tslibs.conversion'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/mnt/tmp/spark-REDACTED/userFiles-REDACTED/dependencies.zip/pandas/__init__.py", line 36, in <module>
ImportError: C extension: No module named 'pandas._libs.tslibs.conversion' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
Any ideas on how to fix this?
In order to ship dependency on the worker, there are two ways one is exactly what you did, zip the file, or simple py file then use --py-file. The problem you encountered is because of missing C dependency on the worker side. Pkg like NumPy/pandas all have c dependency.
In order to solve this, create the virtualenv, and zip the virtualenv including
the python executable
PYSPARK_DRIVER_PYTHON = <path to current working python>
PYSPARK_PYTHON = './venv/<path to python executable>'
pyspark --archives = <path to zip file>#venv
or follow this link

why runtime error happen? After import Mecab

what is problem?
I use python3 windows10 environment is Anaconda
m=MeCab.Tagger("-Ochasen")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\a.sakata\Anaconda3\lib\site-packages\MeCab.py", line 253, in __init__
_MeCab.Tagger_swiginit(self, _MeCab.new_Tagger(*args))
RuntimeError
Your dicrc probably doesn't include the chasen format. This causes the Mecab C lib to die with an error, which results in the runtime error in Python.
I get the same error, and if I run mecab on the command line I get this output:
$ mecab -Ochasen
writer.cpp(63) [!tmp.empty()] unkown format type [chasen]
If you don't get an error on the command line the cause might be something else.

mysql-python won't install on MacOS

So I have tried multiple ways to install mysql-python and MYSQLdb. I have tried downloading through this link: https://sourceforge.net/projects/mysql-python/ and then when I run python setup.py install I get the following errors:
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Traceback (most recent call last):
File "/Users/Jackson/Google Drive/CS520/HW/MySQL-python-1.2.4b4/distribute_setup.py", line 143, in use_setuptools
raise ImportError
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 7, in <module>
use_setuptools()
File "/Users/Jackson/Google Drive/CS520/HW/MySQL-python-1.2.4b4/distribute_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/Users/Jackson/Google Drive/CS520/HW/MySQL-python-1.2.4b4/distribute_setup.py", line 124, in _do_download
to_dir, download_delay)
File "/Users/Jackson/Google Drive/CS520/HW/MySQL-python-1.2.4b4/distribute_setup.py", line 194, in download_setuptools
src = urlopen(url)
File "/Users/Jackson/anaconda3/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Users/Jackson/anaconda3/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/Users/Jackson/anaconda3/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/Users/Jackson/anaconda3/lib/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
File "/Users/Jackson/anaconda3/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Users/Jackson/anaconda3/lib/python3.6/urllib/request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: SSL is required
I could not find a resolution that worked so I tried pip install mysql-python and then I get the following
Traceback (most recent call last):
File "setup.py", line 6, in <module>
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
NameError: name 'url' is not defined
Jacksons-MacBook-Pro:MySQL-python-1.2.4b4 Jackson$ pip install mysql-python
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-kdgbz3qe/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/tmp/pip-build-kdgbz3qe/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-kdgbz3qe/mysql-python/
When I look this problem up I tried running:
pip install --upgrade setuptools
pip install ez_setup
easy_install -U setuptools
With no problems, but then when I tried rerunning the command pip install mysql-python I get the same error as before. I tried downloading the mysqlclient and the mysql/python connector and nothing is working. I just want a fix for trying to install mysql-python, mysqlclient, MYSQLdb, mysql/python connector or anything that will actually work. I already have mysql installed and running as well as Sequel Pro.
I could solve the issue by running the combination of #Devstr an #jsteele. I realized that the python module to connect from python to mysql is not mysql but ```mysql-connector``.
Follow these steps:
brew cask install mysql-connector-python
pip search mysql-connector | grep --color mysql-connector-python
pip install mysql-connector-python-rf
then in python:
import mysql.connector
...
found some useful info: What's the difference between MySQLdb, mysqlclient and MySQL connector/Python?
Maybe use brew?
brew cask install mysql-connector-python
see https://apple.stackexchange.com/questions/130324/how-to-install-mysql-utilities-using-brew-or-brew-cask#136180

how to compile the tutorial program on tensorflow

After configuring the tensorflow, I tried to run the command
bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
But an error occured which I tried every possible but failed to solve.
ERROR: Skipping '//tensorflow/cc:tutorials_example_trainer': error loading package 'tensorflow/cc': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '#local_config_cuda//cuda': Traceback (most recent call last):
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 1042
_create_local_cuda_repository(repository_ctx)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 975, in _create_local_cuda_repository
_host_compiler_includes(repository_ctx, cc)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes
get_cxx_inc_directories(repository_ctx, cc)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories
set(includes_cpp)
The set constructor for depsets is deprecated and will be removed. Please use the depset constructor instead. You can temporarily enable the deprecated set constructor by passing the flag --incompatible_disallow_set_constructor=false
WARNING: Target pattern parsing failed.
ERROR: error loading package 'tensorflow/cc': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '#local_config_cuda//cuda': Traceback (most recent call last):
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 1042
_create_local_cuda_repository(repository_ctx)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 975, in _create_local_cuda_repository
_host_compiler_includes(repository_ctx, cc)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes
get_cxx_inc_directories(repository_ctx, cc)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories
set(includes_cpp)
The set constructor for depsets is deprecated and will be removed. Please use the depset constructor instead. You can temporarily enable the deprecated set constructor by passing the flag --incompatible_disallow_set_constructor=false
INFO: Elapsed time: 2.293s
FAILED: Build did NOT complete successfully (0 packages loaded)
currently loading: tensorflow/cc
Note that: I've installed the CUDA8.0, cuDNN 5.0 and Bazel 0.6.0, My system is Ubuntu 16.04.
It seems there is already an issue open for this problem: https://github.com/tensorflow/tensorflow/issues/11859. Last comment says that the issue can be fixed by editing line 120 in tensorflow/third_party/gpus/cuda_configure.bzl. If that doesn't help I'd subscribe to the issue and wait for a fix.