[Fixed]-Building wheel for cffi (setup.py) … error while installing the packages from requirements.txt in django

21👍

i had this problem and i solved by following:

i used sudo apt install --fix-broken for installing broken packages in my debian machine after that i used this command for installing essential packages
:
sudo apt-get install build-essential libssl-dev libffi-dev python-dev

and after that the problem solved.

5👍

I had this error installing on Python 3.11. The fix was to upgrade to the latest cffi (1.15.1 at the time of this writing).

👤Cory

3👍

I just had the same issue. I was trying to install djoser and the same thing happened. To fix it I just simply downgrade my python from 3.10 to 3.9

👤Melly

3👍

For anyone who experiences this in the future while building a docker image. After a lot of trial and error this is what finally worked:-

RUN python -m venv /py && \
   /py/bin/pip install --upgrade pip && \
   apk add --update alpine-sdk && \
   apk add --update --no-cache postgresql-client && \
   apk add --update --no-cache --virtual .tmp-build-deps \
      build-base gcc python3-dev postgresql-dev musl-dev libffi-dev openssl-dev cargo  && \
   /py/bin/pip install -r /tmp/requirements.txt && \
   if [ $DEV = "true" ]; \
      then /py/bin/pip install -r /tmp/requirements.dev.txt ; \
   fi && \
   rm -rf /tmp && \
   apk del .tmp-build-deps && \
   adduser \
      --disabled-password \
      --no-create-home \
      django-user

Leave a comment