0

I'm trying to put PyAudio on Windows (yes, I know. It is the worst trying to do such) and I've hit a wall. I'm using Python 3.4 64 bit on Windows 10. Knowing the issues with PyAudio's Windows support I downloaded the Windows binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio. More specifically - PyAudio‑0.2.8‑cp35‑none‑win_amd64.whl. After extracting the file I copied the contents into site-packages and just to try copied the entire folder into site-packages (with contents) and changed the folder name to PyAudio. The contents are:

pyaudio.py

_portaudio.cp35-win_amd64.pyd

PyAudio-0.2.8.dist-info(folder){

DESCRIPTION.rst

METADATA

metadata.json

pbr.json

RECORD

top_level

WHEEL }

However, when I try to run PyAudio I get the following import error "No module named '_portaudio'" when it attempts to import as shown below.

try:
    import _portaudio as pa
except ImportError as e:
    print(e)
    print("Please build and install the PortAudio Python " +
          "bindings first.")
    sys.exit(-1)

So, to attempt to fix the error I renamed the pyd to _portaudio and went into the pyd to change the name to _portaudio before the PYInit__portaudio call as well. However, in doing that it attempts to read it as a 32 bit version and gives me the error "DLL load failed: %1 is not a valid Win32 application". Unfortunately, I can't copy and paste _portaudio.cp35-win_amd64 as an import in pyaudio.py because the syntax attempts to resolve the - as a statement. From this point I can't think of anything else to get it working. Any tips would be awesome, thanks!

EDIT: I intentionally put the statement (yes, I know. It is the worst trying to do such) in the post because I know that a linux environment would be a better choice but it wasn't an option. I just didn't want to get comments or answers suggesting I run my project on Ubuntu so please don't remove it. :)

Obj3ctiv3_C_88
  • 1,478
  • 1
  • 17
  • 29
  • 1
    Use [pip to install the .whl file](https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels). – cgohlke Oct 15 '15 at 18:23
  • @cgohlke Thanks so much! I've never had to use a whl so wasn't familiar with the process. I'll vote as best answer if you post it as question. – Obj3ctiv3_C_88 Oct 15 '15 at 19:11
  • [The official installation instructions](http://people.csail.mit.edu/hubert/pyaudio/#downloads) recommend `py -m pip install pyaudio` on Windows and Mac OS X (that uses wheels uploaded to PyPI). @cgohlke you should post your comment as an answer. – jfs Oct 25 '15 at 17:32

0 Answers0