Binance Api Python setup - python

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

Related

gevent 21.12.0 installation failing in mac os monterey

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.

I'm trying to install django in virtual environment but getting some error and I don't understand what is it about

> pip install django
Collecting django
Downloading Django-4.1-py3-none-any.whl (8.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.1/8.1 MB 24.2 MB/s eta 0:00:00
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.4.2-py3-none-any.whl (42 kB)
Collecting asgiref<4,>=3.5.2
Using cached asgiref-3.5.2-py3-none-any.whl (22 kB)
Collecting backports.zoneinfo
Using cached backports.zoneinfo-0.2.1.tar.gz (74 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: backports.zoneinfo
Building wheel for backports.zoneinfo (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for backports.zoneinfo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [41 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14-arm64-cpython-38
creating build/lib.macosx-10.14-arm64-cpython-38/backports
copying src/backports/__init__.py -> build/lib.macosx-10.14-arm64-cpython-38/backports
creating build/lib.macosx-10.14-arm64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_version.py -> build/lib.macosx-10.14-arm64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_common.py -> build/lib.macosx-10.14-arm64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/__init__.py -> build/lib.macosx-10.14-arm64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_zoneinfo.py -> build/lib.macosx-10.14-arm64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_tzpath.py -> build/lib.macosx-10.14-arm64-cpython-38/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'
/private/var/folders/z_/gh45f3y971vg11kt0m32cl440000gn/T/pip-build-env-tklngwk1/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
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.macosx-10.14-arm64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/py.typed -> build/lib.macosx-10.14-arm64-cpython-38/backports/zoneinfo
running build_ext
building 'backports.zoneinfo._czoneinfo' extension
creating build/temp.macosx-10.14-arm64-cpython-38
creating build/temp.macosx-10.14-arm64-cpython-38/lib
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 -I/Users/harshitdubey/Documents/greendeck/django_files/connect-django/.connect/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c lib/zoneinfo_module.c -o build/temp.macosx-10.14-arm64-cpython-38/lib/zoneinfo_module.o -std=c99
lib/zoneinfo_module.c:1:10: fatal error: 'Python.h' file not found
#include "Python.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 backports.zoneinfo
Failed to build backports.zoneinfo
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
My python version
Python 3.8.9
I've tried things like
python -m pip install django
pip install django==4.0.0
but stll can't find any solution.
I have two python versions in my macos I don't thing that's causing the error. Any help will be appreciated.
I have already updated my pip version which is 22.2.2
Try reinstalling your python versions. Before reinstalling completely remove it from control panel > uninstall and also remove from C drive then install again and then try

The evdev library and all dependent libraries won't install in pyenv shim but work on system python

I'm running a relatively clean build of Ubuntu 21.04 and have come across some sort of dependency problem while trying to install the evdev package. I can install it using the version of python I get from apt:
python3/hirsute,now 3.9.4-1 amd64 [installed,automatic]
python3-dev/hirsute,now 3.9.4-1 amd64 [installed]
This version of python is in /usr/bin/python3 and /usr/bin/pip3 install evdev runs without error.
However, I prefer to use pyenv to manage python versions:
> python --version
Python 3.9.5
> pip --version
pip 22.2 from /home/denehoffman/.pyenv/versions/3.9.5/lib/python3.9/site-packages/pip (python 3.9)
Now running pip3 install evdev gives me the following:
> pip3 install evdev
Collecting evdev
Using cached evdev-1.6.0.tar.gz (26 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for evdev, since package 'wheel' is not installed.
Installing collected packages: evdev
Running setup.py install for evdev ... error
error: subprocess-exited-with-error
× Running setup.py install for evdev did not run successfully.
│ exit code: 1
╰─> [46 lines of output]
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/evdev
copying evdev/ff.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/device.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/events.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/uinput.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/genecodes.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/eventio.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/util.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/evtest.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/__init__.py -> build/lib.linux-x86_64-3.9/evdev
copying evdev/ecodes.py -> build/lib.linux-x86_64-3.9/evdev
running build_ext
running build_ecodes
writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
building 'evdev._input' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/evdev
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9 -c evdev/input.c -o build/temp.linux-x86_64-3.9/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
gcc -pthread -shared -L/home/denehoffman/.pyenv/versions/3.9.5/lib -L/home/denehoffman/.pyenv/versions/3.9.5/lib build/temp.linux-x86_64-3.9/evdev/input.o -o build/lib.linux-x86_64-3.9/evdev/_input.cpython-39-x86_64-linux-gnu.so
building 'evdev._uinput' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9 -c evdev/uinput.c -o build/temp.linux-x86_64-3.9/evdev/uinput.o -std=c99 -Wno-error=declaration-after-statement
gcc -pthread -shared -L/home/denehoffman/.pyenv/versions/3.9.5/lib -L/home/denehoffman/.pyenv/versions/3.9.5/lib build/temp.linux-x86_64-3.9/evdev/uinput.o -o build/lib.linux-x86_64-3.9/evdev/_uinput.cpython-39-x86_64-linux-gnu.so
building 'evdev._ecodes' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9 -c evdev/ecodes.c -o build/temp.linux-x86_64-3.9/evdev/ecodes.o -std=c99 -Wno-error=declaration-after-statement
In file included from /home/denehoffman/.pyenv/versions/3.9.5/include/python3.9/Python.h:141,
from evdev/ecodes.c:2:
evdev/ecodes.c: In function ‘moduleinit’:
evdev/ecodes.c:629:29: error: ‘KEY_EMOJI_PICKER’ undeclared (first use in this function)
629 | PyModule_AddIntMacro(m, KEY_EMOJI_PICKER);
| ^~~~~~~~~~~~~~~~
/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9/modsupport.h:146:67: note: in definition of macro ‘PyModule_AddIntMacro’
146 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
| ^
evdev/ecodes.c:629:29: note: each undeclared identifier is reported only once for each function it appears in
629 | PyModule_AddIntMacro(m, KEY_EMOJI_PICKER);
| ^~~~~~~~~~~~~~~~
/home/denehoffman/.pyenv/versions/3.9.5/include/python3.9/modsupport.h:146:67: note: in definition of macro ‘PyModule_AddIntMacro’
146 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
| ^
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: legacy-install-failure
× Encountered error while trying to install package.
╰─> evdev
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I also run into the same error message with wheel installed, so that isn't it.
This also fails with the same error if I make a virtual environment with /usr/bin/python3 -m venv ... which I would think should mimic the system environment in some way.
The reason I'm asking this here rather than on something specific to evdev is that this seems to be some problem with how my environment is set up, as though the header files (particularly modsupport.h) are not the same as they are for the apt installed version. I've tried a clean install of that python as well as the entirety of pyenv to no avail, can anyone tell me what I'm missing here?

Failed to build backports.zoneinfo

in terminal I run command docker build ., but dockerfile fail to install.
Building wheel for backports.zoneinfo (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Building wheel for backports.zoneinfo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [35 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/backports
copying src/backports/__init__.py -> build/lib.linux-x86_64-cpython-38/backports
creating build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/__init__.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_zoneinfo.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_common.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_version.py -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/_tzpath.py -> build/lib.linux-x86_64-cpython-38/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-x86_64-cpython-38/backports/zoneinfo
copying src/backports/zoneinfo/py.typed -> build/lib.linux-x86_64-cpython-38/backports/zoneinfo
running build_ext
building 'backports.zoneinfo._czoneinfo' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/lib
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.8 -c lib/zoneinfo_module.c -o build/temp.linux-x86_64-cpython-38/lib/zoneinfo_module.o -std=c99
error: command 'gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for backports.zoneinfo
Failed to build backports.zoneinfo
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/sh -c pip install -r /requirements.txt' returned a non-zero code: 1
I have tried many things like:
pip install --upgrade pip wheel
pip install backports.zoneinfo
pip install tzdata
sudo apt-get install ruby-full
None of them helped.
As I have seen in code I don't have gcc. I tried to install. But failed.
My OS is Ubuntu 20.04.
Python 3.8.10
Thank you in advance.
In addition to:
sudo apt-get install build-essential
as #JanWilamowski alluded to, you also need. This command installs gcc i.e. the GNU C-compiler (with many other items).
sudo apt-get install python3-dev.
Then if you try pip install backports.zoninfo if should work as expected. It should also be noted that having these installed on your computer is NOT EQUIVALENT to having it installed in the Docker container. Those need to be done separately using Docker compose files.

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