[Django]-ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects

109πŸ‘

βœ…

Avoid installing backports.zoneinfo when using python >= 3.9

Edit your requirements.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 can read more about this here and here

πŸ‘€ayandebnath

42πŸ‘

I was having the same error while deploying my application on heroku and well the problem is actually that when you are deploying it on heroku so heroku by default uses python version 3.10.x and backports.zoneinfo is not working properly with this version so I suggest you to switch to version 3.8.x(stable).

In order to do that you need to tell heroku to switch that version and it can be done as follows :

  1. Create runtime.txt in root directory.
  2. python-3.8.10 <- write this in β€˜runtime.txtβ€˜ there as to specify the version.
  3. heroku will then install this version and you will be not getting anymore error.

PS : worked it for me and later when heroku removes this bug you can switch to python latest version.

8πŸ‘

I was facing the same error while creating my container. I solved the error by using the exact version of my Python venv i.e. 3.8.9

Earlier for the image, I was using 3.8-alpine for a lighter version of the image. But, it wasn’t working out for me and got the same error as yours.

3πŸ‘

this type of problems occur when you forget to modify your requirements.txt file and heroku server uses default settings like it uses python updated version which is not stable.
use the following commands and you will be get rid of this type of problem.

$ git status

you need to modify requirements.txt

$ git add-A

$ git commit -m "Python VERSION-3.8.10"

then push your server and i am sure you will be get rid of this type of problem.
In order to push your server…

$ git push heroku master

3πŸ‘

Downgrading Python from 3.10.5 to 3.9.0 worked for me. I hope this helps.

3πŸ‘

Tried & tested on Mac pro:

Check your python version on your terminal

python3 --version

OR

python --version

If the python version is 3.9 & above , then update the following (backports.zoneinfo) line in your "requirements.txt" file to :

  • backports.zoneinfo;python_version<"3.9"

Run –

pip3 install -r requirements.txt

test running your app again , should work at this stage.

πŸ‘€Vikas Pandey

1πŸ‘

I was facing the same error while deploying my Scrapy spider onto Heroku
but using python-3.9.15 in runtime.txt resolved the issue.
however, the python installed in my venv was 3.8.13

you can try one of these I don’t know their actual meaning but these are recommended by Heroku you can read the full documentation here

Supported runtimes
python-3.10.8 on all supported stacks (recommended)
python-3.9.15 on all supported stacks
python-3.8.15 on Heroku-18 and Heroku-20 only
python-3.7.15 on Heroku-18 and Heroku-20 only
πŸ‘€usman Abbasi

1πŸ‘

for MAC users:

export C_INCLUDE_PATH=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/Headers

only this helped me. source is here

πŸ‘€Artem Chege

1πŸ‘

If you are in CentOS, you might be missing one of the Python development libraries that are required to build backports.zoneinfo. You can try

sudo yum install python3-devel

To install them

0πŸ‘

use python version 3.11 instead of 3.12

these packages yarl==1.9.2 frozenlist==1.3.3 aiohttp==3.8.4 don’t have compatibility with Python 3.12 for some reason or not yet compatible.

πŸ‘€SFARPak

-1πŸ‘

Install venv with python3.9 version helped for me.

python3.9 default version in my system

python3.9 -m venv venv

Leave a comment