I have been suffering to install PyAudio in my M1 Macbook Pro lately. But I finally able to install it. First I installed portaudio using this command: brew install portaudio.
Then I successfully installed PyAudio using this command:
pip install --global-option='build_ext' --global-option='-
I/opt/homebrew/Cellar/portaudio/19.7.0/include' --global-option='-
L/opt/homebrew/Cellar/portaudio/19.7.0/lib' pyaudio
I also checked the directory so that there's no mistake. But whenever I test PyAudio by importing it, it gives me this error:
Could not import the PyAudio C module '_portaudio'. Traceback (most recent call last): File "/Users/arannya/Documents/Python Projects/VASS/main.py", line 1, in <module> import pyaudio File "/Users/arannya/Documents/Python Projects/VASS/venv/lib/python3.9/site-packages/pyaudio.py", line 116, in <module> import _portaudio as pa ImportError: dlopen(/Users/arannya/Documents/Python Projects/VASS/venv/lib/python3.9/site-packages/_portaudio.cpython-39-darwin.so, 2): Symbol not found: _PaMacCore_SetupChannelMap Referenced from: /Users/arannya/Documents/Python Projects/VASS/venv/lib/python3.9/site-packages/_portaudio.cpython-39-darwin.so Expected in: flat namespace in /Users/arannya/Documents/Python Projects/VASS/venv/lib/python3.9/site-packages/_portaudio.cpython-39-darwin.so
Please help me. Thanks in advance.
Related
This is the error that always popped up when trying to import pyaudio :
Could not import the PyAudio C module 'pyaudio._portaudio'.
Traceback (most recent call last):
File "/Users/hong-eungi/PycharmProjects/SmartSpeaker/arch.py", line 2, in <module>
import pyaudio
File "/Users/hong-eungi/PycharmProjects/SmartSpeaker/venv/lib/python3.9/site-packages/pyaudio/__init__.py", line 111, in <module>
import pyaudio._portaudio as pa
ImportError: dlopen(/Users/hong-eungi/PycharmProjects/SmartSpeaker/venv/lib/python3.9/site-packages/pyaudio/_portaudio.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_PaMacCore_SetupChannelMap'
I'm currently using MAC M1, and trying to use pyaudio in python.
python version is 3.10.2.
I've installed portaudio with brew, and linked it.
After that, I've installed pyaudio. The installation was successfully done, but trying to import the module printed the above error.
The things I've tried
I've also tried giving global-option parameters (in the solution of this question):
python -m pip install --global-option='build_ext'
--global-option='-I/opt/homebrew/Cellar/portaudio/19.7.0/include' --global-option='-L/opt/homebrew/Cellar/portaudio/19.7.0/lib' pyaudio
I've also tried putting
arch -arm64
in front of every command to make it run in arm64 architecture.
I've tried pip3 instead of pip.
Does anyone know how to import pyaudio in MAC M1?
I am facing some problem with PyAudio in M1 Macbook Pro. First I installed portaudio with this command
brew install portaudio --HEAD
Then I installed PyAudio
python3 -m pip install pyaudio --global-option="build_ext" --global-option="-I/opt/homebrew/include" --global-option="-L/opt/homebrew/lib"
But when I test it by importing pyaudio, it gives me this error message -
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyaudio'
Help me please!
I installed pyaudio with anaconda python. Using conda install pyaudio on windows.
It said it installed and it also installed PortAudio with it.
However, when I create my file and run it now I get the following issue.
I have no idea what is going on.
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
File "C:\Users\This PC\Desktop\Py\demo.py", line 2, in <module>
import pyaudio
File "C:\Users\This PC\Anaconda3\lib\site-packages\pyaudio.py", line 116, in <module>
import _portaudio as pa
ImportError: DLL load failed: The specified module could not be found.
I ran into this error with win32 py3 using Anaconda3. Re-installing portaudio fixed this:
conda install portaudio
It just updated the package for me, and pyaudio was able to find the DLL then.
I faced a similar issue.
The only way I was able to resolve this was by uninstalling anaconda, installing the latest version of python, and reinstalling the latest version of conda.
I then downloaded the latest .whl file for pyaudio which can be found here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
I moved this file from my downloads and into the site-packages folder of anaconda3:
C:\Users\Projects\Anaconda3\Lib\site-packages
Upon running the command 'pip install pyaudio' OR 'python -m pip install pyaudio' in the anaconda prompt I was good to go
I hope this helps!
After successful installation of the pybgg, when tried to run
$python test_pybbg.py
Got the following error message:
ImportError: No module named blpapi
MacBook:pfinance Allen$ which python
/Users/Allen/anaconda/bin/python
MacBook:pfinance Allen$ python test_pybbg.py
Traceback (most recent call last):
File "test_pybbg.py", line 2, in
import pybbg
File "/Users/Allen/anaconda/lib/python2.7/site-packages/pybbg/init.py", line 8, in
from .pybbg_k import Pybbg
File "/Users/Allen/anaconda/lib/python2.7/site-packages/pybbg/pybbg_k.py", line 8, in
import blpapi
ImportError: No module named blpapi
I used $pip list, but failed to see blpapi from the output list.
Any suggestions on how to fix my problem?
Thanks in advance
Ps. The followings show my installation log
MacBook:pfinance Allen$ pip install git+https://github.com/hubertrogers/pybbg
Collecting git+https://github.com/hubertrogers/pybbg
Cloning https://github.com/hubertrogers/pybbg to /private/var/folders/c6/7s88m85x0fj7l0zc52y_kcbh0000gn/T/pip-XagRDz-build
Installing collected packages: pybbg
Running setup.py install for pybbg ... done
Successfully installed pybbg-0.0.1
Based on the post I have set the library links properly;
MacBook:pfinance Allen$ echo $DYLD_LIBRARY_PATH
/Users/Allen/pfinance/blpapi_cpp_3.8.1.1/Darwin/
MacBook:pfinance Allen$ echo $BLPAPI_ROOT
/Users/Allen/pfinance/blpapi_cpp_3.8.1.1
I am trying to install the base map for use with matplotlib python v2.7 running on Mac OSX Mavericks. I have all the latest versions of all modules (matplotlib, etc) running using anaconda, but keep getting the following error:
Traceback (most recent call last):
File "simpletest.py", line 1, in <module>
from mpl_toolkits.basemap import Basemap
File "/Users/felishalawrence/anaconda/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 37, in <module>
import _geoslib.so
ImportError: dlopen(/Users/felishalawrence/anaconda/lib/python2.7/site-packages/_geoslib.so, 2): Library not loaded: libgeos_c.1.dylib
Referenced from: /Users/felishalawrence/anaconda/lib/python2.7/site-packages/_geoslib.so
Reason: no suitable image found. Did find:
/usr/local/bin/gcc-4.9/libgeos_c.1.dylib: stat() failed with errno=20
Can someone please give me an idea of what is wrong? Thanks!
Try installing the following packages with Homebrew:
brew install numpy
brew install proj
brew install geos
export GEOS_DIR="/usr/local/Cellar/geos/3.10.3/"