Error installing psycopg2 while connecting to postgreSQL db - python

I'm trying to write a code in python which would connect to PostgreSQL and do basic CRUD operations.
The sample code I'm following is importing psycopg2. I tried importing that module via PyCharm and that failed then I tried doing that via Terminal within IDE and it is providing me the error as below:
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_asis.o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_binary.o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_datetime.o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_list.o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_pboolean.o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_pdecimal.o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_pfloat.o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_pint.o build/temp.macosx-10.9-x86_64-3.9/psycopg/adapter_qstring.o build/temp.macosx-10.9-x86_64-3.9/psycopg/aix_support.o build/temp.macosx-10.9-x86_64-3.9/psycopg/bytes_format.o build/temp.macosx-10.9-x86_64-3.9/psycopg/column_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/connection_int.o build/temp.macosx-10.9-x86_64-3.9/psycopg/connection_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/conninfo_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/cursor_int.o build/temp.macosx-10.9-x86_64-3.9/psycopg/cursor_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/diagnostics_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/error_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/green.o build/temp.macosx-10.9-x86_64-3.9/psycopg/libpq_support.o build/temp.macosx-10.9-x86_64-3.9/psycopg/lobject_int.o build/temp.macosx-10.9-x86_64-3.9/psycopg/lobject_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/microprotocols.o build/temp.macosx-10.9-x86_64-3.9/psycopg/microprotocols_proto.o build/temp.macosx-10.9-x86_64-3.9/psycopg/notify_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/pqpath.o build/temp.macosx-10.9-x86_64-3.9/psycopg/psycopgmodule.o build/temp.macosx-10.9-x86_64-3.9/psycopg/replication_connection_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/replication_cursor_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/replication_message_type.o build/temp.macosx-10.9-x86_64-3.9/psycopg/solaris_support.o build/temp.macosx-10.9-x86_64-3.9/psycopg/typecast.o build/temp.macosx-10.9-x86_64-3.9/psycopg/utils.o build/temp.macosx-10.9-x86_64-3.9/psycopg/win32_support.o build/temp.macosx-10.9-x86_64-3.9/psycopg/xid_type.o -L/usr/local/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.9/psycopg2/_psycopg.cpython-39-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: '/Users/mukul/PycharmProjects/Test Assignment/venv/bin/python' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/jf/psd6t3h92zv4dlsskwfq4jvm0000gn/T/pip-install-sesoe_u_/psycopg2_3dea34ab36b9473db07298279bce13e5/setup.py'"'"'; __file__='"'"'/private/var/folders/jf/psd6t3h92zv4dlsskwfq4jvm0000gn/T/pip-install-sesoe_u_/psycopg2_3dea34ab36b9473db07298279bce13e5/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/jf/psd6t3h92zv4dlsskwfq4jvm0000gn/T/pip-record-z7u8cdcp/install-record.txt --single-version-externally-managed --compile --install-headers '/Users/mukul/PycharmProjects/Test Assignment/venv/include/site/python3.9/psycopg2' Check the logs for full command output.
Can anyone please help me with this?
I have already tried installing the latest version of the xcode command tool.
Thanks in advance.

Related

PyAudio won't install: "fatal error: 'portaudio.h' file not found"

I have been trying to install PyAudio but I can't.
I have tried the Homebrew method and the Xcode method:
xcode-select --install
brew remove portaudio
brew install portaudio
pip3 install pyaudio
I even tried this command
pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio
I also tried
pip3 install pyaudio
and
pip install pyaudio
I keep getting this error
/Users/firassyed/opt/anaconda3/envs/env_pytorch/lib/python3.6/site-packages/pip/_internal/commands/install.py:245: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
cmdoptions.check_install_build_global(options)
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Preparing metadata (setup.py) ... done
Skipping wheel build for pyaudio, due to binaries being disabled for it.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /Users/firassyed/opt/anaconda3/envs/env_pytorch/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-pbxf5s_a/pyaudio_3976f98c4d7440d3bbb5800ecc3b675d/setup.py'"'"'; __file__='"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-pbxf5s_a/pyaudio_3976f98c4d7440d3bbb5800ecc3b675d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext -I/usr/local/include -L/usr/local/lib install --record /private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-record-i_lptc1z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/firassyed/opt/anaconda3/envs/env_pytorch/include/python3.6m/pyaudio
cwd: /private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-pbxf5s_a/pyaudio_3976f98c4d7440d3bbb5800ecc3b675d/
Complete output (11 lines):
running build_ext
building '_portaudio' extension
creating build
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include -arch x86_64 -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include -arch x86_64 -DMACOSX=1 -I/usr/local/include -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include/python3.6m -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.6/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/firassyed/opt/anaconda3/envs/env_pytorch/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-pbxf5s_a/pyaudio_3976f98c4d7440d3bbb5800ecc3b675d/setup.py'"'"'; __file__='"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-pbxf5s_a/pyaudio_3976f98c4d7440d3bbb5800ecc3b675d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext -I/usr/local/include -L/usr/local/lib install --record /private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-record-i_lptc1z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/firassyed/opt/anaconda3/envs/env_pytorch/include/python3.6m/pyaudio Check the logs for full command output.
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/firassyed/opt/anaconda3/envs/env_pytorch/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-ozic18ff/pyaudio_0f1cab72b9cf407cb344f0b0fc90d0e4/setup.py'"'"'; __file__='"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-ozic18ff/pyaudio_0f1cab72b9cf407cb344f0b0fc90d0e4/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-wheel-rw8wdejj
cwd: /private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-ozic18ff/pyaudio_0f1cab72b9cf407cb344f0b0fc90d0e4/
Complete output (16 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.6
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include -arch x86_64 -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include -arch x86_64 -DMACOSX=1 -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include/python3.6m -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.6/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyaudio
Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /Users/firassyed/opt/anaconda3/envs/env_pytorch/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-ozic18ff/pyaudio_0f1cab72b9cf407cb344f0b0fc90d0e4/setup.py'"'"'; __file__='"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-ozic18ff/pyaudio_0f1cab72b9cf407cb344f0b0fc90d0e4/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-record-9pe8tglt/install-record.txt --single-version-externally-managed --compile --install-headers /Users/firassyed/opt/anaconda3/envs/env_pytorch/include/python3.6m/pyaudio
cwd: /private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-ozic18ff/pyaudio_0f1cab72b9cf407cb344f0b0fc90d0e4/
Complete output (18 lines):
running install
/Users/firassyed/opt/anaconda3/envs/env_pytorch/lib/python3.6/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.6
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include -arch x86_64 -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include -arch x86_64 -DMACOSX=1 -I/Users/firassyed/opt/anaconda3/envs/env_pytorch/include/python3.6m -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.6/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/firassyed/opt/anaconda3/envs/env_pytorch/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-ozic18ff/pyaudio_0f1cab72b9cf407cb344f0b0fc90d0e4/setup.py'"'"'; __file__='"'"'/private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-install-ozic18ff/pyaudio_0f1cab72b9cf407cb344f0b0fc90d0e4/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/j0/5j_xyczd6ddc5z2hm8wsbpwr0000gn/T/pip-record-9pe8tglt/install-record.txt --single-version-externally-managed --compile --install-headers /Users/firassyed/opt/anaconda3/envs/env_pytorch/include/python3.6m/pyaudio Check the logs for full command output.
Try:
pip install pipwin
pipwin install pyaudio

How can I install pyaudio on a mac?

I am trying to install pyaudio on a Mac.
Here is what I have done:
Installed python 3.9.7
Installed homebrew
Removed portaudio (brew remove portaudio)
Installed portaudio (brew install portaudio)
Now I am trying to install pyaudio:
python3 -m pip install pyaudio
(same result for pip3 install pyaudio)
This is the error message that I get:
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/hc/z83533l573lc7bbdnfqd7jzw0000gn/T/pip-install-ukm0_nma/pyaudio_11253f82c20448a3a6ab37fa24ca3049/setup.py'"'"'; __file__='"'"'/private/var/folders/hc/z83533l573lc7bbdnfqd7jzw0000gn/T/pip-install-ukm0_nma/pyaudio_11253f82c20448a3a6ab37fa24ca3049/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/hc/z83533l573lc7bbdnfqd7jzw0000gn/T/pip-record-giib8e7d/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyaudio
cwd: /private/var/folders/hc/z83533l573lc7bbdnfqd7jzw0000gn/T/pip-install-ukm0_nma/pyaudio_11253f82c20448a3a6ab37fa24ca3049/
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.9
copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.9
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-x86_64-3.9
creating build/temp.macosx-10.9-x86_64-3.9/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.9/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/hc/z83533l573lc7bbdnfqd7jzw0000gn/T/pip-install-ukm0_nma/pyaudio_11253f82c20448a3a6ab37fa24ca3049/setup.py'"'"'; __file__='"'"'/private/var/folders/hc/z83533l573lc7bbdnfqd7jzw0000gn/T/pip-install-ukm0_nma/pyaudio_11253f82c20448a3a6ab37fa24ca3049/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/hc/z83533l573lc7bbdnfqd7jzw0000gn/T/pip-record-giib8e7d/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyaudio Check the logs for full command output.
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m pip install --upgrade pip' command.
What can I do?
I have tried the various suggestions in the search engines and YouTube.
Download Pyaudio and install it manually
Download Link
Another guide
Homebrew and building PyAudio also requires installing the Command Line Tools for Xcode
Linux guide
You can use the Linux guide to install it on your mac
There are other ways too:
Use Anaconda: Install anaconda and use its package manager and other abilities.
Use Virtual Envs: Install Pyenv

Error installing mysql-client my_config.h not found Ubuntu 20.04 LTS

Yes i know its asked several times but majority of them havent helped me , so i have similar issue about when i tried to install pip install mysqlclient==1.3.10
it gives :
building '_mysql' extension
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 -I/usr/include/mysql -I/home/mert/.local/share/virtualenvs/api-mVh3j5tK/include -I/usr/local/include/python3.6m -c _mysql.c -o build/temp.linux-x86_64-3.6/_mysql.o
_mysql.c:29:10: fatal error: my_config.h: No such file or directory
29 | #include "my_config.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/mert/.local/share/virtualenvs/api-mVh3j5tK/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vpcd78dz/mysqlclient_02860d9ff5b24c97abfc0dd675c9003c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vpcd78dz/mysqlclient_02860d9ff5b24c97abfc0dd675c9003c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-s0tuhkac/install-record.txt --single-version-externally-managed --compile --install-headers /home/mert/.local/share/virtualenvs/api-mVh3j5tK/include/site/python3.6/mysqlclient Check the logs for full command output.
If i try to put that file inside usr/include/mysql then it gives ieeefp.h not found error.

Installing pyaudio MacOs difficulties

I tried installing pyaudio this way (it's probably worth noting that I'm currently using an M1 MacBook):
brew install portaudio
pip install pyaudio
and encountered this problem:
zsh: command not found: pip
Then I tried using:
python3 -m install pyaudio
and this is what happened:
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/setup.py'"'"'; __file__='"'"'/private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-record-9sps13ds/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyaudio
cwd: /private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.9
copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.9
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-x86_64-3.9
creating build/temp.macosx-10.9-x86_64-3.9/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.9/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/setup.py'"'"'; __file__='"'"'/private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-install-l9y2ss43/pyaudio_082af32b7df940b88c2b176ce46b477e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t8/c4fh02g911z6jksqbs6qlg080000gn/T/pip-record-9sps13ds/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyaudio Check the logs for full command output.
Any idea how I could fix this and get pyaudio to be installed in my computer?

How to install pyodbc python library in server?

I have python 3.8 and I am trying to install pyodbc library to connect sql server but getting error. Please help me how to install it? Is there any other library to connect sql server?
I am using below command -
python3 -m pip install pyodbc
Error I am getting-
Collecting pyodbc
Using cached pyodbc-4.0.30.tar.gz (266 kB)
Building wheels for collected packages: pyodbc
Building wheel for pyodbc (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-67s6uwc7
cwd: /tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/
Complete output (10 lines):
running bdist_wheel
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.30 -I/app/python3.7.4/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyodbc
Running setup.py clean for pyodbc
Failed to build pyodbc
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-w_eqzv_4/install-record.txt --single-version-externally-managed --compile --install-headers /app/python3.7.4/include/python3.7m/pyodbc
cwd: /tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/
Complete output (10 lines):
running install
running build
running build_ext
building 'pyodbc' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.30 -I/app/python3.7.4/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-w_eqzv_4/install-record.txt --single-version-externally-managed --compile --install-headers /app/python3.7.4/include/python3.7m/pyodbc Check the logs for full command output.
You need to install the first dependency.
!apt install unixodbc-dev --yes
!pip install pyodbc

Categories