python

Error - Building wheel for backports.zoneinfo (pyproject.toml) did not run successfully [Solved]

If you are using Python version 3.9 or later then you can get the above error while installing packages from requirement.txt file. To resolve this error change in requiremnt.txt file as below.

# Edit your requirement.txt file
FROM

backports.zoneinfo==0.2.1

TO

backports.zoneinfo;python_version<"3.9"

OR

backports.zoneinfo==0.2.1;python_version<"3.9"

You may be getting the below error while installing the python packages using pip:

Building wheels for collected packages: backports.zoneinfo, msgpack
  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]
      /private/var/folders/pg/tkjfqt1x2y9c3hfdmvx36ctc0000gn/T/pip-build-env-4w9u08o9/overlay/lib/python3.11/site-packages/setuptools/config/setupcfg.py:520: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-311
      creating build/lib.macosx-10.9-universal2-cpython-311/backports
      copying src/backports/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/backports
      creating build/lib.macosx-10.9-universal2-cpython-311/backports/zoneinfo
      copying src/backports/zoneinfo/_version.py -> build/lib.macosx-10.9-universal2-cpython-311/backports/zoneinfo
      copying src/backports/zoneinfo/_common.py -> build/lib.macosx-10.9-universal2-cpython-311/backports/zoneinfo
      copying src/backports/zoneinfo/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/backports/zoneinfo
      copying src/backports/zoneinfo/_zoneinfo.py -> build/lib.macosx-10.9-universal2-cpython-311/backports/zoneinfo
      copying src/backports/zoneinfo/_tzpath.py -> build/lib.macosx-10.9-universal2-cpython-311/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.macosx-10.9-universal2-cpython-311/backports/zoneinfo
      copying src/backports/zoneinfo/py.typed -> build/lib.macosx-10.9-universal2-cpython-311/backports/zoneinfo
      running build_ext
      building 'backports.zoneinfo._czoneinfo' extension
      creating build/temp.macosx-10.9-universal2-cpython-311
      creating build/temp.macosx-10.9-universal2-cpython-311/lib
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Users/ankitdhama/Desktop/Workspace/wizhour_web/env/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c lib/zoneinfo_module.c -o build/temp.macosx-10.9-universal2-cpython-311/lib/zoneinfo_module.o -std=c99
      lib/zoneinfo_module.c:600:19: error: use of undeclared identifier '_PyLong_One'
                  one = _PyLong_One;
                        ^
      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
  Building wheel for msgpack (pyproject.toml) ... done
  Created wheel for msgpack: filename=msgpack-1.0.4-cp311-cp311-macosx_10_9_universal2.whl size=127655 sha256=dc77427353d89cdf88b6f08ff8fe2030312f9bfe656454be78824b055bc9c054
  Stored in directory: /Users/ankitdhama/Library/Caches/pip/wheels/be/38/62/bffc8d68ee5e3a6a3080b2f8a520e8302fe333528d93a488af
Successfully built msgpack
Failed to build backports.zoneinfo
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects

Solution

The error is generated because you are using the Python version 3.9 or above. The package that is causing error is:

backports.zoneinfo==0.2.1

To solve this error change the above line to:

backports.zoneinfo==0.2.1;python_version<"3.9"

Or, you can also use:

backports.zoneinfo;python_version<"3.9"

This will solve the error and your package will be installed successfully.

Was this helpful?