0

I am trying to install PyAudio inside my webfaction server.

enter image description here

It gives me the following error. I got the same error while installing it locally but I read the solution and the sudo command solves it. The problem is webfaction does not allow the sudo command.

What I have tried is that I copied my pyaudio local installation from site-packages folder to my online production server.

If I do pip freeze it shows me that it is installed. I tried running my function which uses PyAudio but it gives me the error

" Could not find PyAudio.Check installation" 

EDIT 1:

The following code is going to solve the problem of installing port audio and pyaudio on web faction:

export CPPFLAGS="-I$HOME/include $CPPFLAGS"
export LDFLAGS="-L$HOME/lib $LDFLAGS"
export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
mkdir src
cd src
wget http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
git clone https://people.csail.mit.edu/hubert/git/pyaudio.git
tar -xf pa_stable_v190600_20161030.tgz 
cd portaudio
./configure --prefix=$HOME
make
make install
cd ../pyaudio/
python2.7 setup.py install --prefix=$HOME

You can change the version of python to the version you currently have. I had 2.7 so I changed to it.

EDIT2: This installs pyaudio and port audio. The problem is that I am still getting an error, "Pyaudio installation not found". Was there any error installing port audio or they have not been installed correctly?

EDIT3:

I figured out something that if you open the django shell inside and type import pyaudio. You will get the following error.

 Could not import the PyAudio C module '_portaudio'.
 Traceback (most recent call last):
 File "<console>", line 1, in <module>
 File "/home/ammarkhan123/lib/python2.7/pyaudio.py", line 116, in <module>
 import _portaudio as pa
 ImportError: No module named _portaudio
indexOutOfBounds
  • 541
  • 7
  • 27

2 Answers2

0

Try to install python-dev package. And then install pyaudio. :D

0

It looks like you are missing portaudio. Since Webfaction is shared hosting, you can't install it system-wide. I'd suggest two remedies:

1) Open a ticket with Webfaction support and see if they will install the portaudio devel headers. I doubt this will work, but they've surprised me before.

2) Compile portaudio from source in your home directory, and then add the appropriate environment variables to your .bash_profile. I usually create ~/opt as a place for all of my custom compiled libraries.

Instructions I wrote to do this for openssl are here: https://github.com/will-in-wi/letsencrypt-webfaction/wiki/Install-custom-OpenSSL-and-Ruby-on-CentOS-5-host

Instructions to custom compile MySQL are here: https://community.webfaction.com/questions/3838/compiling-a-private-mysql-installation-in-your-home-directory

will_in_wi
  • 2,623
  • 1
  • 16
  • 21
  • I got it installed but the problem is that it still throws an error saying "Could not find PyAudio" Check installation – indexOutOfBounds May 24 '17 at 11:59
  • You still need to install pyaudio with PIP, probably in a virtual env. You will probably need some kind of environment variable or argument to define the location where portaudio is installed. – will_in_wi May 26 '17 at 11:36
  • I have done that and there is this other command which is pip install --user pyaudio and it says successfully installed but still same error. – indexOutOfBounds May 27 '17 at 10:47
  • I have edited the answer. Have a look at the latest edit – indexOutOfBounds May 27 '17 at 10:50