Installing PyAudio on windows: ModuleNotFoundError: No module named 'pyaudio' - python

I am using bash terminal in vscode. When I try to run my code:
#!/usr/bin/env python3
from pyaudio import speech_recognition as sr
r = sr.Recognizer()
mic = sr.Microphone()
with mic as source:
audio = r.listen(source)
as seen in https://realpython.com/python-speech-recognition/#working-with-microphones I get this error:
python3 live_audio.py
Traceback (most recent call last):
File "live_audio.py", line 3, in <module>
from pyaudio import speech_recognition as sr
ModuleNotFoundError: No module named 'pyaudio'
I have pyaudio installed on my machine as in the cmd when I run "pip3 install pyaudio" it says:
Requirement already satisfied: pyaudio in c:\users\user1\appdata\local\programs\python\python39-32\lib\site-packages (0.2.11)"
However in the bash terminal when I run "pip3 install pyaudio" I get this error message:
pip3 install pyaudio
Defaulting to user installation because normal site-packages is not writeable
Collecting pyaudio
Using cached PyAudio-0.2.12.tar.gz (42 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyaudio (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
copying src/pyaudio.py -> build/lib.linux-x86_64-cpython-38
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv
-O2 -fPIC -I/usr/local/include -I/usr/include -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-cpython-38/src/_portaudiomodule.o
src/_portaudiomodule.c:31:10: fatal error: portaudio.h: No such file or directory
31 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
--- Logging error ---
Traceback (most recent call last):
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 177, in emit
self.console.print(renderable, overflow="ignore", crop=False, style=style)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/console.py", line 1673, in print
extend(render(renderable, render_options))
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/console.py", line 1305, in render
for render_output in iter_render:
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
for line in lines:
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/segment.py", line 249, in split_lines
for segment in segments:
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/console.py", line 1283, in render
renderable = rich_cast(renderable)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
renderable = cast_method()
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
pip_cmd = get_best_invocation_for_this_pip()
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/utils/entrypoints.py", line 58, in get_best_invocation_for_this_pip
if found_executable and os.path.samefile(
File "/usr/lib/python3.8/genericpath.py", line 101, in samefile
s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip'
Call stack:
File "/home/user1/.local/bin/pip3", line 8, in <module>
sys.exit(main())
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/cli/main.py", l.py", line 70, in main
return command.main(cmd_args)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/cli/base_comman_command.py", line 101, in main
return self._main(args)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/cli/base_comman_command.py", line 223, in _main
self.handle_pip_version_check(options)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/cli/req_commandcommand.py", line 190, in handle_pip_version_check
pip_self_version_check(session, options)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/self_outdated_cdated_check.py", line 236, in pip_self_version_check
logger.warning("[present-rich] %s", upgrade_prompt)
File "/usr/lib/python3.8/logging/__init__.py", line 1446, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1577, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1587, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1649, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 950, in handle
self.emit(record)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/utils/logging.pgging.py", line 179, in emit
self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.2.2', new='22.3'),)
I have also installed the .whl for my machine using "pip3 install PyAudio-0.2.11-cp38-cp38-win_amd64.whl" but I get this error (in bash terminal):
Defaulting to user installation because normal site-packages is not writeable
ERROR: PyAudio-0.2.11-cp38-cp38-win_amd64.whl is not a supported wheel on this
platform.
Does anyone have any idea what I'm doing wrong?
Thank you

Related

Failing to install Sparkmagic using pip

I am trying to install sparkmaic in jupyter notebook through pip but getting below error:
Command:
pip install sparkmagic
error:
Collecting gssapi>=1.6.0
Using cached gssapi-1.8.1.tar.gz (94 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
/bin/sh: 1: krb5-config: not found
Traceback (most recent call last):
File "/home/e004255/.local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/home/e004255/.local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/e004255/.local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-guoi_e0p/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/tmp/pip-build-env-guoi_e0p/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-guoi_e0p/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
exec(code, locals())
File "<string>", line 109, in <module>
File "<string>", line 22, in get_output
File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'krb5-config --libs gssapi' returned non-zero exit status 127.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
It looks like your system is missing a tool named krb5-config. You might be able to install it with:
sudo apt install krb5-config
Thanks #bernhard
but, I had to install dev tools too (ubuntu 20.04).
sudo apt-get install libkrb5-dev

Pip install fail on Mac "Getting requirements to build wheel ... error"

When I try to use pip to install packages on Mac I run into this error:
"Getting requirements to build wheel ... error
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully."
It only happens when I try to install certain packages (scipy and sklearn). Other packages install fine (numpy and pandas).
I am on a Mac running Python: 3.10.7 and pip 22.2.2. I am relatively new to all of this so please let me know if you need more information and I appreciate any help.
FULL ERROR:
cobykirkland#Cobys-MacBook-Pro ~ % pip install scipy
Collecting scipy
Using cached scipy-1.9.1.tar.gz (42.0 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [61 lines of output]
The Meson build system
Version: 0.62.2
Source dir: /private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51
Build dir: /private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51/.mesonpy-j1n79wk8/build
Build type: native build
Project name: SciPy
Project version: 1.9.1
C compiler for the host machine: cc (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.11)")
C linker for the host machine: cc ld64 650.9
C++ compiler for the host machine: c++ (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.11)")
C++ linker for the host machine: c++ ld64 650.9
Host machine cpu family: aarch64
Host machine cpu: arm64
Compiler for C supports arguments -Wno-unused-but-set-variable: NO
Library m found: YES
../../meson.build:41:0: ERROR: Unknown compiler(s): [['gfortran'], ['flang'], ['nvfortran'], ['pgfortran'], ['ifort'], ['g95']]
The following exception(s) were encountered:
Running "gfortran --version" gave "[Errno 2] No such file or directory: 'gfortran'"
Running "gfortran -V" gave "[Errno 2] No such file or directory: 'gfortran'"
Running "flang --version" gave "[Errno 2] No such file or directory: 'flang'"
Running "flang -V" gave "[Errno 2] No such file or directory: 'flang'"
Running "nvfortran --version" gave "[Errno 2] No such file or directory: 'nvfortran'"
Running "nvfortran -V" gave "[Errno 2] No such file or directory: 'nvfortran'"
Running "pgfortran --version" gave "[Errno 2] No such file or directory: 'pgfortran'"
Running "pgfortran -V" gave "[Errno 2] No such file or directory: 'pgfortran'"
Running "ifort --version" gave "[Errno 2] No such file or directory: 'ifort'"
Running "ifort -V" gave "[Errno 2] No such file or directory: 'ifort'"
Running "g95 --version" gave "[Errno 2] No such file or directory: 'g95'"
Running "g95 -V" gave "[Errno 2] No such file or directory: 'g95'"
A full log can be found at /private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51/.mesonpy-j1n79wk8/build/meson-logs/meson-log.txt
+ meson setup --native-file=/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=/Library/Frameworks/Python.framework/Versions/3.10 /private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51 /private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51/.mesonpy-j1n79wk8/build
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-build-env-zc95ob3s/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 969, in get_requires_for_build_wheel
with _project(config_settings) as project:
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-build-env-zc95ob3s/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 948, in _project
with Project.with_temp_working_dir(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-build-env-zc95ob3s/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 777, in with_temp_working_dir
yield cls(source_dir, tmpdir, build_dir)
File "/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-build-env-zc95ob3s/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 682, in __init__
self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
File "/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-build-env-zc95ob3s/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 713, in _configure
self._meson(
File "/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-build-env-zc95ob3s/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 696, in _meson
return self._proc('meson', *args)
File "/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-build-env-zc95ob3s/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 691, in _proc
subprocess.check_call(list(args))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51/.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2', '--prefix=/Library/Frameworks/Python.framework/Versions/3.10', '/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51', '/private/var/folders/nh/bw_22w4j4pg23hczs34hg5jc0000gn/T/pip-install-keuagdr1/scipy_af79793bfc2c43319072f465a4dd6b51/.mesonpy-j1n79wk8/build']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
scipy provides pip-installable wheels for scipy-1.9.2-cp310-cp310-macosx_12_0_arm64.whl. For various reasons arm64 wheels are only available for Monterey, not Big Sur. I'm guessing that your OS is currently Big Sur, otherwise the correct wheel should've been installed. You have a few options:
Upgrade to Monterey.
Use conda to install scipy
Try using rosetta to run an x86_64 Python, there are wheels for that architecture that will run on Monterey - this will be more complicated.

AWS Elastic Beanstalk failed to install Python package using requirements.txt - Firebase-Admin

I have searched similar questions, but no answers solve my problem. I am trying to install firebase-admin using pip. Everything works well locally, but when I push to aws elastic beanstalk it gives me the error below When I remove firebase-admin and its dependencies everything works fine. I think it may specifically have an error with grpcio being installed but not completely sure, and firebase needs it installed to work. Some answers say that firebase-admin is dynamic and aws else does not support that. I am wondering if there is a solution to this problem so I can install firebase. Thank you
2020-06-21 04:13:35 INFO Environment update is starting.
2020-06-21 04:13:40 INFO Deploying new version to instance(s).
2020-06-21 04:13:51 ERROR Your requirements.txt is invalid. Snapshot your logs for details.
2020-06-21 04:13:55 ERROR [Instance: i-06c2884999a9d6064] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2020-06-21 04:13:55 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
My requirments.txt file:
APScheduler==3.6.3
asgiref==3.2.10
braintree==4.1.0
CacheControl==0.12.6
cachetools==4.1.0
certifi==2020.4.5.2
chardet==3.0.4
defusedxml==0.6.0
Django==3.0.7
django-allauth==0.42.0
django-cors-headers==3.4.0
django-mysql==3.7.0
django-rest-auth==0.9.5
djangorestframework==3.11.0
firebase-admin==4.3.0
google-api-core==1.21.0
google-api-python-client==1.9.3
google-auth==1.18.0
google-auth-httplib2==0.0.3
google-cloud-core==1.3.0
google-cloud-firestore==1.7.0
google-cloud-storage==1.29.0
google-resumable-media==0.5.1
googleapis-common-protos==1.52.0
grpcio==1.29.0
httplib2==0.18.1
idna==2.9
msgpack==1.0.0
mysqlclient==1.4.6
numpy==1.18.5
oauthlib==3.1.0
protobuf==3.12.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
PyJWT==1.7.1
python3-openid==3.1.0
pytz==2020.1
requests==2.24.0
requests-oauthlib==1.3.0
rsa==4.6
six==1.15.0
sqlparse==0.3.1
twilio==6.42.0
tzlocal==2.1
uritemplate==3.0.1
urllib3==1.25.9
Some of the Log File:
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DOPENSSL_NO_ASM=1 -D_WIN32_WINNT=1536 -DGPR_BACKWARDS_COMPATIBILITY_MODE=1 -DHAVE_CONFIG_H=1 -DGRPC_ENABLE_FORK_SUPPORT=1 -DPyMODINIT_FUNC=extern "C" __attribute__((visibility ("default"))) PyObject* -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1 -Isrc/python/grpcio -Iinclude -I. -Ithird_party/abseil-cpp -Ithird_party/address_sorting/include -Ithird_party/cares -Ithird_party/cares/cares -Ithird_party/cares/config_linux -Ithird_party/boringssl-with-bazel/src/include -Ithird_party/upb -Isrc/core/ext/upb-generated -Ithird_party/zlib -I/usr/include/python3.6m -c src/python/grpcio/grpc/_cython/cygrpc.cpp -o python_build/temp.linux-x86_64-3.6/src/python/grpcio/grpc/_cython/cygrpc.o -std=c++11 -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions -pthread
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
creating tmp/tmpi4o4pn51
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.6m -c /tmp/tmpi4o4pn51/a.c -o tmp/tmpi4o4pn51/a.o
Traceback (most recent call last):
File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 127, in _compile
extra_postargs)
File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
_classic_spawn(self, command)
File "/usr/lib64/python3.6/distutils/ccompiler.py", line 909, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/usr/lib64/python3.6/distutils/spawn.py", line 36, in spawn
_spawn_posix(cmd, search_path, dry_run=dry_run)
File "/usr/lib64/python3.6/distutils/spawn.py", line 159, in _spawn_posix
% (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 262, in build_extensions
build_ext.build_ext.build_extensions(self)
File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 533, in build_extension
depends=ext.depends)
File "/usr/lib64/python3.6/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 246, in new_compile
pp_opts)
File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 129, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-29tk6f4m/grpcio/setup.py", line 400, in <module>
cmdclass=COMMAND_CLASS,
File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib64/python3.6/distutils/command/install.py", line 593, in run
self.run_command('build')
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 75, in run
_build_ext.run(self)
File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 267, in build_extensions
"Failed `build_ext` step:\n{}".format(formatted_exception))
commands.CommandError: Failed `build_ext` step:
Traceback (most recent call last):
File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 127, in _compile
extra_postargs)
File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
_classic_spawn(self, command)
File "/usr/lib64/python3.6/distutils/ccompiler.py", line 909, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/usr/lib64/python3.6/distutils/spawn.py", line 36, in spawn
_spawn_posix(cmd, search_path, dry_run=dry_run)
File "/usr/lib64/python3.6/distutils/spawn.py", line 159, in _spawn_posix
% (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 262, in build_extensions
build_ext.build_ext.build_extensions(self)
File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 533, in build_extension
depends=ext.depends)
File "/usr/lib64/python3.6/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/tmp/pip-build-29tk6f4m/grpcio/src/python/grpcio/commands.py", line 246, in new_compile
pp_opts)
File "/usr/lib64/python3.6/distutils/unixccompiler.py", line 129, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1
Command "/opt/python/run/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-29tk6f4m/grpcio/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-ox9mho6_-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/grpcio" failed with error code 1 in /tmp/pip-build-29tk6f4m/grpcio/
You are using pip version 9.0.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2020-06-19 20:06:16,263 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 (Executor::NonZeroExitStatus)
[2020-06-19T20:06:16.273Z] INFO [6647] - [Application update app-200619_130554#310/AppDeployStage0/AppDeployPreHook/03deploy.py] : Activity failed.
[2020-06-19T20:06:16.273Z] INFO [6647] - [Application update app-200619_130554#310/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2020-06-19T20:06:16.273Z] INFO [6647] - [Application update app-200619_130554#310/AppDeployStage0] : Activity failed.
[2020-06-19T20:06:16.275Z] INFO [6647] - [Application update app-200619_130554#310] : Completed activity. Result:
Application update - Command CMD-AppDeploy failed
[2020-06-19T20:07:34.137Z] INFO [6815] - [CMD-BundleLogs] : Starting activity...
[2020-06-19T20:07:34.138Z] INFO [6815] - [CMD-BundleLogs/AddonsBefore] : Starting activity...
[2020-06-19T20:07:34.138Z] INFO [6815] - [CMD-BundleLogs/AddonsBefore] : Completed activity.
[2020-06-19T20:07:34.138Z] INFO [6815] - [CMD-BundleLogs/BundleLogs] : Starting activity...
[2020-06-19T20:07:34.138Z] INFO [6815] - [CMD-BundleLogs/BundleLogs/BundleLogs] : Starting activity...
pip install grpcio==1.26.0rc1
The solution is to downgrade grpcio. Unfortunately, since Django 2.1 is the latest compatible version with Elastic Beanstalk Python 3.6 platform, we sometimes have to downgrade other packages accordingly.
Hopefully AWS upgrades the platform for use with the latest Django eventually...
I wasn't using firebase-admin, but I am trying to deploy a Django application via Elastic Beanstalk and also ran into this error during the step when requirements.txt was being installed.
To add to Connor's answer, I moved grpcio==1.26.0rc1 up in my requirements.txt file until it was above the package which must have been installing an incompatible version of grpcio:
backcall==0.1.0
certifi==2019.3.9
chardet==3.0.4
decorator==4.3.0
dj-database-url==0.5.0
Django==2.2
django-cors-headers==2.4.0
djangorestframework==3.9.1
djangorestframework-jwt==1.11.0
grpcio==1.26.0rc1
FWIW it now works fine with Django 2.2 on the latest AMI (Python 3.6 running on 64bit Amazon Linux/2.9.16).

While installing horovod setpy.py on GPU server showing error :-Failed to load the native TensorFlow runtime

While running following command on GPU server:
$HOROVOD_WITH_PYTORCH=1 HOROVOD_WITH_TENSORFLOW=1 python --no-cache-dir setup.py install --user
It's showing the following error:
running install
running bdist_egg
running egg_info
writing horovod.egg-info/PKG-INFO
writing dependency_links to horovod.egg-info/dependency_links.txt
writing requirements to horovod.egg-info/requires.txt
writing top-level names to horovod.egg-info/top_level.txt
reading manifest file 'horovod.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching 'third_party/eigen/Eigen/src/IterativeSolvers/*'
writing manifest file 'horovod.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
gcc -pthread -B /export/application/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -std=c++11 -fPIC -O2 -Wall -I/export/application/anaconda3/include/python3.7m -c build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.cc -o build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -shared -B /export/application/anaconda3/compiler_compat -L/export/application/anaconda3/lib -Wl,-rpath=/export/application/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.o -o build/temp.linux-x86_64-3.7/test_compile/test_cpp_flags.so
gcc -pthread -B /export/application/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/export/application/anaconda3/include/python3.7m -c build/temp.linux-x86_64-3.7/test_compile/test_link_flags.cc -o build/temp.linux-x86_64-3.7/test_compile/test_link_flags.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -shared -B /export/application/anaconda3/compiler_compat -L/export/application/anaconda3/lib -Wl,-rpath=/export/application/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ -Wl,--version-script=horovod.lds build/temp.linux-x86_64-3.7/test_compile/test_link_flags.o -o build/temp.linux-x86_64-3.7/test_compile/test_link_flags.so
error: import tensorflow failed, is it installed?
Traceback (most recent call last):
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/export/application/anaconda3/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/export/application/anaconda3/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /lib64/libm.so.6: version `GLIBC_2.23' not found (required by /home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 72, in check_tf_version
import tensorflow as tf
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/__init__.py", line 27, in <module>
from tensorflow._api.v2 import audio
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/_api/v2/audio/__init__.py", line 8, in <module>
from tensorflow.python.ops.gen_audio_ops import decode_wav
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/export/application/anaconda3/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/export/application/anaconda3/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /lib64/libm.so.6: version `GLIBC_2.23' not found (required by /home/pg2019/cse/19071010/.local/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I have tried installing tensorflow using following command: pip install --user tensorflow==1.14.0, and pip install --user tensorflow, and pip install --user tensorflow-gpu
I following this tutorial: https://github.com/horovod/horovod
I have tried the command below and it is running but while running
$pip install --no-cache-dir --user horovod
But if I run following program
$mpirun -np 4 python tensorflow2_mnist.py
as said on https://github.com/horovod/horovod/tree/master/examples it's showing as similar error:
Failed to load the native TensorFlow runtime.

Can't install pyproj module in Google Datalab Jupyter notebook

I'm trying to install pyproj within a Google Datalab Jupyter notebook as a required dependency for the basemap library. I've tried two methods, needless to say neither has worked.
Method 1: Cloning from git
!git clone https://github.com/jswhit/pyproj.git
Outputs:
Cloning into 'pyproj'...
remote: Counting objects: 2811, done.
remote: Total 2811 (delta 0), reused 0 (delta 0), pack-reused 2810
Receiving objects: 100% (2811/2811), 5.65 MiB | 1.55 MiB/s, done.
Resolving deltas: 100% (1951/1951), done.
Checking connectivity... done.
And install command:
!python ./pyproj/setup.py install
Outputs:
using bundled proj4..
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
Traceback (most recent call last):
File "./pyproj/setup.py", line 86, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "/usr/lib/python2.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile
raise CompileError, msg
distutils.errors.CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Method 2: Using pip
!pip install pyproj
Outputs:
Collecting pyproj
Using cached pyproj-1.9.5.1.tar.gz
Complete output from command python setup.py egg_info:
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
using bundled proj4..
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-FcWGXL/pyproj/setup.py", line 72, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "/usr/lib/python2.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile
raise CompileError, msg
distutils.errors.CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-FcWGXL/pyproj/
What method can be used to install pyproj from within a Datalab Jupyter notebook?
Looks like you need gcc for it to build. Do apt-get update && apt-get install -y gcc in a cell then try the pip install pyproj again.

Categories