gevent 21.12.0 installation failing in mac os monterey - python

I am trying to install gevent 21.12.0 on Mac OS Monterey (version 12.6) with python 3.9.6 and pip 21.3.1. But it is failing with the below error. Any suggestion?
(venv) debrajmanna#debrajmanna-DX6QR261G3 qa % pip install gevent
Collecting gevent
Using cached gevent-21.12.0.tar.gz (6.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting greenlet<2.0,>=1.1.0
Using cached greenlet-1.1.3-cp39-cp39-macosx_10_9_universal2.whl
Collecting zope.event
Using cached zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
Collecting zope.interface
Using cached zope.interface-5.4.0-cp39-cp39-macosx_10_9_universal2.whl
Requirement already satisfied: setuptools in /Users/debrajmanna/code/python/github/spotnana/venv/lib/python3.9/site-packages (from gevent) (60.2.0)
Building wheels for collected packages: gevent
Building wheel for gevent (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: /Users/debrajmanna/code/python/github/spotnana/venv/bin/python /Users/debrajmanna/code/python/github/spotnana/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/tmpi2i_lqc2
cwd: /private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370
Complete output (46 lines):
running bdist_wheel
running build
running build_py
running build_ext
generating cffi module 'build/temp.macosx-10.9-universal2-cpython-39/gevent.libuv._corecffi.c'
Running '(cd "/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps/libev" && sh ./configure -C > configure-output.txt )' in /private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370
generating cffi module 'build/temp.macosx-10.9-universal2-cpython-39/gevent.libev._corecffi.c'
Not configuring libev, 'config.h' already exists
Not configuring libev, 'config.h' already exists
building 'gevent.libev.corecext' extension
Embedding c-ares <cffi.setuptools_ext._add_c_module.<locals>.build_ext_make_mod object at 0x104f40bb0> <_setuputils.Extension('gevent.resolver.cares') at 0x1048f4640>
Inserted build/temp.macosx-10.9-universal2-cpython-39/c-ares/include in include dirs ['build/temp.macosx-10.9-universal2-cpython-39/c-ares/include', '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9', '/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps', '/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps/c-ares/include', '/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps/c-ares/src/lib', 'src/gevent', 'src/gevent/libev', 'src/gevent/resolver', '.']
Running '(cd "/private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/deps/c-ares" && if [ -r include/ares_build.h ]; then cp include/ares_build.h include/ares_build.h.orig; fi && sh ./configure --disable-dependency-tracking -C CFLAGS="-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration" && cp src/lib/ares_config.h include/ares_build.h "$OLDPWD" && cat include/ares_build.h && if [ -r include/ares_build.h.orig ]; then mv include/ares_build.h.orig include/ares_build.h; fi) > configure-output.txt' in /private/var/folders/ls/b6mf3_jd17916k8bs8jwy2g80000gn/T/pip-install-qprhzmpd/gevent_54aaef476d2d411ba9ad080d0291a370/build/temp.macosx-10.9-universal2-cpython-39/c-ares/include
configure: WARNING: Continuing even with errors mentioned immediately above this line.
rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
configure: WARNING: Continuing even with errors mentioned immediately above this line.
building 'gevent.resolver.cares' extension
building 'gevent._gevent_c_greenlet_primitives' extension
building 'gevent._gevent_c_hub_primitives' extension
building 'gevent._gevent_c_hub_local' extension
building 'gevent._gevent_c_waiter' extension
building 'gevent._gevent_cgreenlet' extension
building 'gevent._gevent_c_tracer' extension
building 'gevent._gevent_c_abstract_linkable' extension
building 'gevent._gevent_c_semaphore' extension
building 'gevent._gevent_clocal' extension
building 'gevent._gevent_c_ident' extension
building 'gevent._gevent_c_imap' extension
building 'gevent._gevent_cevent' extension
building 'gevent._gevent_cqueue' extension
src/gevent/queue.c:7071:12: warning: unused function '__pyx_pw_6gevent_14_gevent_cqueue_5Queue_25__nonzero__' [-Wunused-function]
static int __pyx_pw_6gevent_14_gevent_cqueue_5Queue_25__nonzero__(PyObject *__pyx_v_self) {
^
1 warning generated.
src/gevent/queue.c:7071:12: warning: unused function '__pyx_pw_6gevent_14_gevent_cqueue_5Queue_25__nonzero__' [-Wunused-function]
static int __pyx_pw_6gevent_14_gevent_cqueue_5Queue_25__nonzero__(PyObject *__pyx_v_self) {
^
1 warning generated.
building 'gevent.libev._corecffi' extension
building 'gevent.libuv._corecffi' extension
build/temp.macosx-10.9-universal2-cpython-39/gevent.libuv._corecffi.c:50:14: fatal error: 'pyconfig.h' file not found
# include <pyconfig.h>
^~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for gevent
Failed to build gevent
ERROR: Could not build wheels for gevent, which is required to install pyproject.toml-based projects

Looked all over trying to figure out a solution to this problem until I finally stumbled on this post.
I think the issue is specific to the virtual environment. I had the project open with it's own venv in PyCharm, and it seems that the python distribution headers were not findable.
To reiterate the solution linked:
Find where the Python.h file is defined. I was able to find it using find /usr/local -name Python.h
Copy the path to the directory Python.h is defined in
Set the C_INCLUDE_PATH environment variable accordingly, for me: export C_INCLUDE_PATH="/usr/local/munki/Python.framework/Versions/3.9/include/python3.9"
After this, I was able to run pip3 install gevent with no issues.

Related

PyAudio (MacOS, M1) - ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

Help me install the PyAudio library on MacOS (M1), I tried everything :(
My actions
brew remove portaudio
brew install portaudio
pip3 install pyaudio
brew reinstall portaudio
==> Downloading https://ghcr.io/v2/homebrew/core/portaudio/manifests/19.7.0-1
Already downloaded: /Users/code232/Library/Caches/Homebrew/downloads/2ba32ec74d5080567eae3412994e5c8bc39afcd1dacfe3a0d347d210e47c5f7e--portaudio-19.7.0-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/portaudio/blobs/sha256:8f390b
Already downloaded: /Users/code232/Library/Caches/Homebrew/downloads/c1fa92f01d5c060c79bea1c294e230dc5a074a49c42f39b9bf68bffa6c79ea98--portaudio--19.7.0.arm64_monterey.bottle.1.tar.gz
==> Reinstalling portaudio
==> Pouring portaudio--19.7.0.arm64_monterey.bottle.1.tar.gz
🍺 /opt/homebrew/Cellar/portaudio/19.7.0: 33 files, 543.2KB
==> Running brew cleanup portaudio...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew).
pip install pyaudio
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.macosx-10.9-universal2-cpython-39
copying src/pyaudio.py -> build/lib.macosx-10.9-universal2-cpython-39
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-universal2-cpython-39
creating build/temp.macosx-10.9-universal2-cpython-39/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMACOSX=1 -I/usr/local/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-universal2-cpython-39/src/_portaudiomodule.o
src/_portaudiomodule.c:31:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/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
How to install pyaudio on mac using Python 3?
First install Xcode. Then restart your computer. Afterwards run the commands in sequence,
xcode-select --install
brew remove portaudio
brew install portaudio
pip3 install pyaudio

How to install pyAudio without subprocess-exited-with-error code, "failed to build wheels"

Every time I run pip install pyaudio I get the following error
pip3 install pyaudio
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.macosx-10.9-universal2-cpython-310
copying src/pyaudio.py -> build/lib.macosx-10.9-universal2-cpython-310
running build_ext
building '_portaudio' extension
creating build/temp.macosx-10.9-universal2-cpython-310
creating build/temp.macosx-10.9-universal2-cpython-310/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMACOSX=1 -I/usr/local/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-universal2-cpython-310/src/_portaudiomodule.o
src/_portaudiomodule.c:31:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' 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
I tried pip install, reinstalling port audio, but nothing works, any advice how to tackle this problem?
This was tested on an M1 Max, so pyaudio should definitely support the platform.
Since you have portaudio installed from homebrew, do this...
LDFLAGS="-L$(brew --prefix portaudio)/lib" CFLAGS="-I$(brew --prefix portaudio)/include" pip install pyaudio
And hopefully you have it built and installed:
python3 -c "import pyaudio; print(pyaudio.__version__)"
0.2.12
I am a M1 mac user.
There has been overwhelming answers toward this way which hasn't worked for me.
when installing pyaudio, pip cannot find portaudio.h in /usr/local/include
But I found #wkl's answer worked for me ! thanks.
Yesterday I started a project with a voice assistant, but stumbled on PyAudio :((
I tried a lot of different things, as QUANTUM says, but when I tried what WKL recommends, everything fell into place! Amazing, thank you WKL 🥳🍾 You saved my nerve cells!
INSTEAD OF THIS: python3 -c "import pyaudio; print(pyaudio.__version__)"
BETTER USE THIS: pip show pyaudio
⚠️ I'm sorry to post here as I'm a new user and can't rate his work for the rating to take effect.

Can't find `lz4` header when installing `roslz4` with pip on a Mac

I'm trying to install roslz4 on my Mac, and I get the following error.
In file included from ros_comm/utilities/roslz4/src/_roslz4module.c:37:
include/roslz4/lz4s.h:38:10: fatal error: 'lz4.h' file not found
#include <lz4.h>
^~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
[end of output]
To counter this, I installed lz4 with brew which ran successfully
> brew install lz4
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/manifests/1.9.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/blobs/sha256:d222923849a6fefd391ab6705f1468c10d287c08ab9c4b5053a18a552139e262
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:d222923849a6fefd391ab6705f1468c10d287c08ab9c4b5053a18a552139e262?se=2022-06-14T22%3A20%3A00Z&s
######################################################################## 100.0%
==> Pouring lz4--1.9.3.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/lz4/1.9.3: 22 files, 620.6KB
==> Running `brew cleanup lz4`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
However, it does not appear to have resolved the problem.
Full pip output:
> pip install --extra-index-url https://rospypi.github.io/simple/ roslz4
Looking in indexes: https://pypi.org/simple, https://rospypi.github.io/simple/
Collecting roslz4
Using cached https://github.com/rospypi/simple/raw/any/roslz4/roslz4-1.14.3.post2.tar.gz (18 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: roslz4
Building wheel for roslz4 (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-arm64-3.8
creating build/lib.macosx-10.14-arm64-3.8/roslz4
copying ros_comm/utilities/roslz4/src/roslz4/__init__.py -> build/lib.macosx-10.14-arm64-3.8/roslz4
running build_ext
building '_roslz4' extension
creating build/temp.macosx-10.14-arm64-3.8
creating build/temp.macosx-10.14-arm64-3.8/ros_comm
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DXXH_NAMESPACE=ROSLZ4_ -Iinclude -Iroscpp_core/cpp_common/include -I/Users/cmauceri/Workspace/run-mgmt/jupyter_venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c ros_comm/utilities/roslz4/src/_roslz4module.c -o build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4/src/_roslz4module.o -Wno-strict-prototypes -Wno-missing-field-initializers -Wno-unused-variable -Wno-strict-aliasing
In file included from ros_comm/utilities/roslz4/src/_roslz4module.c:37:
include/roslz4/lz4s.h:38:10: fatal error: 'lz4.h' file not found
#include <lz4.h>
^~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for roslz4
Running setup.py clean for roslz4
Failed to build roslz4
Installing collected packages: roslz4
Running setup.py install for roslz4 ... error
error: subprocess-exited-with-error
× Running setup.py install for roslz4 did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running install
running build
running build_py
creating build
creating build/lib.macosx-10.14-arm64-3.8
creating build/lib.macosx-10.14-arm64-3.8/roslz4
copying ros_comm/utilities/roslz4/src/roslz4/__init__.py -> build/lib.macosx-10.14-arm64-3.8/roslz4
running build_ext
building '_roslz4' extension
creating build/temp.macosx-10.14-arm64-3.8
creating build/temp.macosx-10.14-arm64-3.8/ros_comm
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4
creating build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DXXH_NAMESPACE=ROSLZ4_ -Iinclude -Iroscpp_core/cpp_common/include -I/Users/cmauceri/Workspace/run-mgmt/jupyter_venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c ros_comm/utilities/roslz4/src/_roslz4module.c -o build/temp.macosx-10.14-arm64-3.8/ros_comm/utilities/roslz4/src/_roslz4module.o -Wno-strict-prototypes -Wno-missing-field-initializers -Wno-unused-variable -Wno-strict-aliasing
In file included from ros_comm/utilities/roslz4/src/_roslz4module.c:37:
include/roslz4/lz4s.h:38:10: fatal error: 'lz4.h' file not found
#include <lz4.h>
^~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> roslz4
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Do I need to add the location of lz4 headers to an environment variable? How can I get pip to find the header?
After doing brew install lz4 the following (from this SO post by rgov) worked for me without the need of any source code changes:
CFLAGS="-I$(brew --prefix lz4)/include" \
LDFLAGS="-L$(brew --prefix lz4)/lib" \
pip install roslz4 --extra-index-url https://rospypi.github.io/simple/
Answer from a coworker:
My solution was to download the roslz4 tarball and manually add the include folders and library symbols into the setup config, then run python setup.py install
Here are the first few lines of my setup.py file (which includes my addition to include and lib)
import platform
from setuptools import setup, Extension
extra_compile_args = []
include_dirs = [
"include",
"roscpp_core/cpp_common/include",
"/usr/local/Cellar/lz4/1.9.3/include",
]
libraries = ["lz4"]
library_dirs = ["/usr/local/Cellar/lz4/1.9.3/lib"]
define_macros = [
("XXH_NAMESPACE", "ROSLZ4_"),
]
My changes are the lines with "Cellar" and "library_dirs"

Binance Api Python setup

I created a Bot to trade BTC with Binance and am currently trying to set my Raspberry Pi 3 B+ up. With every pip install python-binance I get
Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Building wheels for collected packages: backports.zoneinfo
Building wheel for backports.zoneinfo (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /home/ubuntu/test/venv/bin/python3 /tmp/tmp6c7k6imv build_wheel /tmp/tmpuge_0m5b
cwd: /tmp/pip-install-cje139s6/backports.zoneinfo
Complete output (39 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.8
creating build/lib.linux-aarch64-3.8/backports
copying src/backports/__init__.py -> build/lib.linux-aarch64-3.8/backports
creating build/lib.linux-aarch64-3.8/backports/zoneinfo
copying src/backports/zoneinfo/_tzpath.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
copying src/backports/zoneinfo/_common.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
copying src/backports/zoneinfo/__init__.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
copying src/backports/zoneinfo/_version.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
copying src/backports/zoneinfo/_zoneinfo.py -> build/lib.linux-aarch64-3.8/backports/zoneinfo
running egg_info
writing src/backports.zoneinfo.egg-info/PKG-INFO
writing dependency_links to src/backports.zoneinfo.egg-info/dependency_links.txt
writing requirements to src/backports.zoneinfo.egg-info/requires.txt
writing top-level names to src/backports.zoneinfo.egg-info/top_level.txt
reading manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.png' under directory 'docs'
warning: no files found matching '*.svg' under directory 'docs'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_output'
adding license file 'LICENSE'
adding license file 'licenses/LICENSE_APACHE'
writing manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt'
copying src/backports/zoneinfo/__init__.pyi -> build/lib.linux-aarch64-3.8/backports/zoneinfo
copying src/backports/zoneinfo/py.typed -> build/lib.linux-aarch64-3.8/backports/zoneinfo
running build_ext
building 'backports.zoneinfo._czoneinfo' extension
creating build/temp.linux-aarch64-3.8
creating build/temp.linux-aarch64-3.8/lib
aarch64-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 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/ubuntu/test/venv/include -I/usr/include/python3.8 -c lib/zoneinfo_module.c -o build/temp.linux-aarch64-3.8/lib/zoneinfo_module.o -std=c99
lib/zoneinfo_module.c:1:10: fatal error: Python.h: No such file or directory
1 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for backports.zoneinfo
Failed to build backports.zoneinfo
ERROR: Could not build wheels for backports.zoneinfo which use PEP 517 and cannot be installed directly
I tried to update pip, wheel, setuptools to the newest version, ran the same command on my desktop computer, where it worked without problem.
The systeminformation for my Raspberry Pi are:
OS: Ubuntu 20.04.3 LTS
Python: 3.8.10
pip: 20.0.2
wheel: 0.37.0
setuptools: 58.0.4
I ran sudo apt install python3-dev and it worked!
I faced the same issue on my Raspberry Pi. Use pip3 install python-binance instead of pip install python-binance
I Faced this problem in past and had post about it but this is direct solution.
Details
The issue is mostly related to retrieving data from OS About Current Time With IANA And backports.zoneinfo is pre-builted for Windows And We Have to Build The Package For Linux Or MacOS With Ruby Compiler Or Any Other Language Specified By Error Also.
First Solution
Upgrade the pip with wheel and Try Again Installing.
pip install --upgrade pip wheel
pip install backports.zoneinfo
Second Solution
Try Installing the Alternative Package Named tzdata. ( Worked for My fastapi project. )
The Package Supports Python 3 But It's Readme Is Not Updated About the Python 2 Support By Dev IDK Why 🤔.
pip install tzdata
Third Solution
Install Ruby Compiler From Your System Package Manager and Run The pip code again.
Given Below is for Ubuntu.
sudo apt-get install ruby-full
pip install backports.zoneinfo

Error building 'lxml.etree' extension

I'm trying to install lxml, on an Ubuntu server running Python 2.6 (in a virtualenv - the system Python is 2.5).
I've checked out via svn and as a result I've also install Cython, as per the instructions.
However, I get the following error when running python setup.py build:
Building lxml version 2.3.alpha1-76211.
Building with Cython 0.11.
Using build configuration of libxslt 1.1.22
Building against libxml2/libxslt in the following directory: /usr/lib
running build
running build_py
running build_ext
cythoning src/lxml/lxml.etree.pyx to src/lxml/lxml.etree.c
Error converting Pyrex file to C:
------------------------------------------------------------
...
c_child = _findChildForwards(c_node, 0)
while c_child is not NULL:
if c_child.type == tree.XML_ELEMENT_NODE:
for i in range(c_tag_count):
if _tagMatchesExactly(c_child, c_ns_tags[2*i], c_ns_tags[2*i+1]):
c_next = _findChildForwards(c_child, 0) or _nextElement(c_child)
^
------------------------------------------------------------
/home/admin/web/blink/lxml/src/lxml/cleanup.pxi:246:64: Cannot assign type 'int' to 'xmlNode *'
Error converting Pyrex file to C:
building 'lxml.etree' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/home/admin/python/2.6.5/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
error: command 'gcc' failed with exit status 1
And very similar errors if i try python setup.py bdist_egg, python setup.py build_ext -i or make
Trying to install via easy_install or pip produces the same error - although the former just hangs indefinitely.
As far as I am aware, all of the various dependencies, such as python-dev are installed.
What am I missing / doing wrong?
"I've checked out via svn" ...
"Building lxml version 2.3.alpha1-76211" ...
You appear to be on the bleeding edge. Suggestions: Use a released version of the lxml source. Consult with the lxml author/maintainer.

Categories

Resources