I'm trying to write a program to record information from my computers microphone an save it to a file. PyAudio seems like one of the better packages for doing this, and they even have a binary for Windows 7 (Python 2.7). I downloaded the executable file and ran it to set up PyAudio, but when I try to import PyAudio into a python script now I get an error:
Please build and install the PortAudio Python bindings first.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyaudio
File "C:\Python27\lib\site-packages\pyaudio.py", line 103, in <module>
sys.exit(-1)
SystemExit: -1
If I look at pyaudio.py, the code that it's failing on is:
# attempt to import PortAudio
try:
import _portaudio as pa
except ImportError:
print "Please build and install the PortAudio Python " +\
"bindings first."
sys.exit(-1)
Also, in case it's relevant, if I go to Python27\Lib\site-packages (where pyaudio.py is) there is a file called portaudio_x64.dll.
The documentation on their site only seems to have instructions for if you want to install PyAudio by building from source code. Additionally, it says that PortAudio v19 is included in the binary, so I assumed it would just work after running the setup executable.
I have no idea what's going wrong and I really need this running soon. Any ideas on what's going wrong? Or if anyone has recommendations for similar packages that work better specifically with Windows 7 (64-bit) and Python 2.7 (Enthought distribution), as well as cross-platform, I'd love to hear them.
Copying the answer from the comments in order to remove this question from the "Unanswered" filter:
Try the binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
~ answer per cgohlke
Related
I have recently bought a new laptop and was viewing some python projects of mine which I made on my pc. For one of them I use the python-bitvavo-api library which I installed using pip3 install python-bitvavo-api. The version I installed is 1.2.2 which is the latest on their website.
Now when I try to import it using this code: from python_bitvavo_api.bitvavo import Bitvavo, I get the following error:
Traceback (most recent call last):
File "C:\Users\indig\OneDrive\Documenten\Python Projects\Personal\Cryptone\Cryptone.py", line 6, in <module>
from python_bitvavo_api.bitvavo import Bitvavo
ModuleNotFoundError: No module named 'python_bitvavo_api'
I read online that it may occur when using multiple python versions, Im only using 1 and thats python 3.7
Btw. I have the same error with the Pillow module, so it might be a setting in visual studio that I dont know of. Anyway, someone please help. If you need more details please ask.
How are you running it? From the terminal or from VS?
You can also check the installed libraries running the command pip list
I would like to install PySide2 on my Windows 10, Python version 3.8, despite the wheels not being released for it yet.
Naturally, I have first tried the pip install --python-version 3.7 command to see if simply getting everything, but for the previous Python version, would be fine. It didn't work.
So instead I installed QT on my machine as well as every required dependency and tool to build it manually. I have progressed quite far and managed to successfully build shiboken2, but failed to build PySide2 itself.
The errors I keep getting are about missing DLL-s when trying to import shiboken2. Unfortunately, the output is rather unhelpful as it doesn't actually tell me which ones are missing, and I couldn't figure that out on my own.
The error from the manual building is as follows (nmake command in C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2 directory):
Scanning dependencies of target QtCore_pyi
Traceback (most recent call last):
File "C:/PySide2/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 294, in <module>
generate_all_pyi(outpath, options=options)
File "C:/PySide2/pyside-setup/sources/pyside2/PySide2/QtCore/../support/generate_pyi.py", line 251, in generate_all_pyi
import PySide2
File "C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2\PySide2\__init__.py", line 51, in <module>
_setupQtDirectories()
File "C:\PySide2\pyside-setup\pyside3_build\py3.8-qt5.12.6-32bit-release\pyside2\PySide2\__init__.py", line 21, in _setupQtDirectories
import shiboken2
ImportError: DLL load failed while importing shiboken2: The specified module could not be found.
I would normally wait patiently until the wheels are released, but I can't find any information on the progress for Windows, and I know the library is available for Python3.8 on other platforms.
Do you recommend any steps to find out what's wrong with my build (I would normally use pip install for PySide2 so this is all new to me), or know how to solve the problem directly? I know shiboken2.cp38-win32.pyd is there and I've also included it in my PATH env var just in case, same for shiboken2.cp38-win32.dll - but these don't seem to be the missing files.
Note: Should this be a Super User question (?)
On Windows platform simple pip install PySide2 is not enough, you should make post-install steps. As part of PySide2 installation you got pywin32_postinstall.py script (Not sure about Win10, but on Windows 7 the path is C:\Users\<your_user>\AppData\Local\Programs\Python\Python38\Scripts\)
You should run pywin32_postinstall.py -install to register DLLs.
I'm currently trying to install the Python package spacepy due to its ability to read CDF files, along with a few other useful functions. However, any time I try to install this module I receive a myriad of errors - whether I try to install it via Anaconda, command prompt, or by downloading the package manually and running setup.py from the package directory. Currently, I've spent hours trying to chase down these errors, but as I'm not a programmer it's been slow going.
I've managed to "install" it, however the module throws an error when trying to load it:
Traceback (most recent call last):
File "<ipython-input-1-4bcf91e29885>", line 1, in <module>
import spacepy
File "C:\Anaconda\lib\site-packages\spacepy\__init__.py", line 329, in <module>
_read_config(rcfile)
File "C:\Anaconda\lib\site-packages\spacepy\__init__.py", line 297, in _read_config
_write_defaults(rcfile, defaults)
File "C:\Anaconda\lib\site-packages\spacepy\__init__.py", line 236, in _write_defaults
key=k, value=defaults[k], ver=__version__))
IOError: [Errno 0] Error
...and so I don't believe it's been installed properly, and one or more of the errors from the initial build is causing issues.
This package has a number of dependencies, most being other Python modules. The only one that the installer would be unable to do itself would be the Fortran compiler (for which I have installed myself using MinGW), however this shouldn't prevent the package from installing.
Here is the complete log of errors that I recieve when trying to force-reinstall it via the command prompt:
python -m pip install --upgrade --force-reinstall spacepy
So it turns out that, among a few smaller errors with the dependencies here and there (that could be fixed just by following the errors thrown), the major issue was the version of numpy. Spacepy was designed for numpy v1.6, and doesn't seem to be backwards compatible with future versions of numpy (like the current v1.12).
Rolling back my version of numpy, as well as moving over to a linux virtual environment (which allowed complete control of modules and dependencies) eventually got spacepy on my system. Now I've just got to become more familiar with linux!
If I use the arrow keys in either python or ipython, I don't get what I should, but instead a weird combination of characters: everything is like in this thread, except that I never compiled python from source.
What happened is roughly this: for some mysterious reasons that nobody was able to decipher (see this thread on ubuntuforums), my Kubuntu user stopped working properly and I had to set up a new one. On this new users, I didn't have Enthought python, so I performed (I hope) a global installation of it - and Canopy.
On this python, the arrow keys don't work.
Can you please help me? Please be patient, I'm a beginner...
Thanks in advance!
EDIT: output of python -c 'import readline':
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named readline
EDIT2: Inspired by your comments, I tried the following
/usr/local/Canopy_32bit/User/bin/python setup.py install
for the readline module: it worked!!!
I couldn't get rid of Enthought python as I need all of the packages for scientific computation. Thanks a lot guys, you helped!
If running the command python -c 'import readline' gives you the following output:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: libreadline.so.5: cannot open shared object file: No such file or directory
then you need to install the older libreadline in your system. On Ubuntu/Kubuntu it is libreadline5 , on Fedora it is compat-readline5
I don't have enough reputation to comment, so I have to put this in as an answer, but when installing Enthought did you by any chance replace your original python install on your machine? I vaguely remember the install script asking me whether I wanted to make Enthought my default python install.
You might still need to rebuild your Python as posted in the original question that you linked.
I would like to capture raw data from the audio out, using Python. In the Python docs it seems that using ossaudiodev works for this purpose. However, I am using Ubuntu 11.10, which has no /dev/dsp:
>>> import ossaudiodev
>>> ossaudiodev.open('r');
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/dev/dsp'
Has anybody got a clue how to capture the sound my sound card outputs using Python?
OSS is an older and deprecated audio system for Linux. The current standard is to use ALSA, and to layer on top of ALSA with either JACK or PulseAudio. Ubuntu uses PulseAudio.
The best thing you could do is to find good Python bindings for connecting to PulseAudio. I just did a quick Google search and didn't find anything for you, and I don't have time to follow up more right now.
EDIT: I just remembered that ALSA does have an OSS compatibility mode. You might be able to install the OSS compatibility stuff, then just use the Python code you already have.
https://help.ubuntu.com/community/alsa-oss
http://www.alsa-project.org/main/index.php/Main_Page
I have got programs to work which require /dev/dsp by using
aoss <PROGRAM NAME AND ARGUMENTS HERE>
If you type aoss on Ubuntu's command line, it will tell you the package to install and that should, in turn, install the needed dependencies. If it doesn't work off the bat, you can try loading a kernel module such as sudo modprobe snd_mixer_oss.