I am having backports.zoneinfo (0.2.1) package as a dependency of the dateparser package.
Currently, my CI set up involves a docker image of the latest supported ubuntu instance from GitHub Actions. Unfortunately, it fails to build the wheel for zoneinfo. It raises the following error:
lib/zoneinfo_module.c: In function ‘zoneinfo_fromutc’:
lib/zoneinfo_module.c:600:19: error: ‘_PyLong_One’ undeclared (first use in this function); did you mean ‘_PyLong_New’?
600 | one = _PyLong_One;
| ^~~~~~~~~~~
| _PyLong_New
lib/zoneinfo_module.c:600:19: note: each undeclared identifier is reported only once for each function it appears in
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for backports.zoneinfo
I looked up the source code, but I am not too familiar with CPython and the package itself. Is there a dependency I am missing if the gcc can’t build a wheel?
Problem
Python Failed building wheel for backports.zoneinfo For Operating System Other Than Windows Like Linux Or MacOs.
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
withwheel
and Try Again Installing.
pip install --upgrade pip wheel
pip install backports.zoneinfo
Enter fullscreen mode
Exit fullscreen mode
Second Solution
Try Installing the Alternative Package Named
tzdata
. ( Worked for Myfastapi
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
Enter fullscreen mode
Exit fullscreen mode
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
Enter fullscreen mode
Exit fullscreen mode
Give a reaction if any one solutions helped you in any way.
Bye 👋.
Hey 😍
Want to help the DEV Community feel more like a community?
Head over to the Welcome Thread and greet some new community members!
It only takes a minute of your time, and goes a long way!
I’m new to python development and I was trying using django but I’m facing this error while installing django using
pip3 install django~=4.0
.
I tried few solution but none of them worked.
I already tried
- Upgrading pip to latest version
pip install backports.zoneinfo
but that too failed.- pip install —upgrade pip wheel
I’m using Python 3.8.9 and mac M1
Collecting django~=4.0
Using cached Django-4.1-py3-none-any.whl (8.1 MB)
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
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)
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/bw/1s6x6hxx7zs5wdt200bhyn900000gp/T/pip-build-env-9dkhvyjx/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/apandey/env/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
You should have this file on your computer.
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/Headers/Python.h
If so, first run
export C_INCLUDE_PATH=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/Headers
Then pip install backports.zoneinfo
Sorry, I can’t add a comment
The answer of Brandon helped but if I try to create a new one project the error still happens.
Is there a way to solve this once and for all?
Back to Top