How to fix the ImportError: cannot import name ‘formatargspec’ from ‘inspect’ (/usr/lib/python3.12/inspect.py). Did you mean: ‘formatargvalues’?

I’m trying to run django app usind docker .. it gives me this error when i try to docker-compose up --build :

water_maps  |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
water_maps  |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
water_maps  |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
water_maps  |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
water_maps  |   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
water_maps  |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
water_maps  |   File "/var/www/html/demo_app/water_maps/__init__.py", line 4, in <module>
water_maps  |     from celery import Celery
water_maps  |   File "/usr/local/lib/python3.12/dist-packages/celery/__init__.py", line 17, in <module>
water_maps  |     from . import local  # noqa
water_maps  |     ^^^^^^^^^^^^^^^^^^^
water_maps  |   File "/usr/local/lib/python3.12/dist-packages/celery/local.py", line 17, in <module>
water_maps  |     from .five import PY3, bytes_if_py2, items, string, string_t
water_maps  |   File "/usr/local/lib/python3.12/dist-packages/celery/five.py", line 7, in <module>
water_maps  |     import vine.five
water_maps  |   File "/usr/local/lib/python3.12/dist-packages/vine/__init__.py", line 8, in <module>
water_maps  |     from .abstract import Thenable
water_maps  |   File "/usr/local/lib/python3.12/dist-packages/vine/abstract.py", line 6, in <module>
water_maps  |     from .five import with_metaclass, Callable
water_maps  |   File "/usr/local/lib/python3.12/dist-packages/vine/five.py", line 364, in <module>
water_maps  |     from inspect import formatargspec, getargspec as _getargspec  # noqa
water_maps  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
water_maps  | ImportError: cannot import name 'formatargspec' from 'inspect' (/usr/lib/python3.12/inspect.py). Did you mean: 'formatargvalues'?

here is how my Dockerfile looks like :

FROM ubuntu

RUN apt-get update

# Avoid tzdata infinite waiting bug
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Africa/Cairo

RUN apt clean
RUN apt-get update
RUN apt-get install -y apt-utils vim curl apache2 apache2-utils git
RUN apt-get -y install python3 libapache2-mod-wsgi-py3
RUN apt -y install certbot python3-certbot-apache
RUN ln /usr/bin/python3 /usr/bin/python
RUN apt-get -y install python3-pip
RUN apt -y install software-properties-common
RUN add-apt-repository universe
RUN apt update
#Add sf to avoid ln: failed to create hard link '/usr/bin/pip': File exists
RUN ln -sf /usr/bin/pip3 /usr/bin/pip
RUN pip install --upgrade pip --break-system-packages
RUN pip install django ptvsd --break-system-packages
RUN pip uninstall web3.py --break-system-packages
RUN pip install git+https://github.com/ethereum/web3.py.git --break-system-packages
RUN apt install wait-for-it
RUN apt-get -y install gettext
RUN apt-get -y install poppler-utils
RUN apt-get -y install redis-server
RUN a2enmod headers
RUN service apache2 restart
COPY www/demo_app/water_maps/requirements.txt requirements.txt
RUN pip install -r requirements.txt --break-system-packages
ADD ./demo_site.conf /etc/apache2/sites-available/000-default.conf
EXPOSE 80 5432
WORKDIR /var/www/html/demo_app
#CMD ["apache2ctl", "-D", "FOREGROUND"]
#CMD ["python", "manage.py", "migrate", "--no-input"]

And here is how my docker-compose.yaml file looks like :

version: "2"

services:

  db:
    image: postgres:14
    restart: always 
    volumes:
      - ./data/db:/var/lib/postgresql/data
      - ./www/:/var/www/html
      - ./www/demo_app/kml_files:/var/www/html/demo_app/kml_files
      - ./www/demo_app/temp_kml_file:/var/www/html/demo_app/temp_kml_file
      - ./www/demo_app/upload:/var/www/html/demo_app/upload
      - ./data/log:/var/log/apache2
    ports:
      - '5432:5432'
    environment:
      - POSTGRES_DB=database_innvoentiq
      - POSTGRES_USER=database_user_innvoentiq
      - POSTGRES_PASSWORD=Yahoo000@

  django-apache2:
    build: .
    container_name: water_maps
    restart: always 
    environment:
      - POSTGRES_DB=database_innvoentiq
      - POSTGRES_USER=database_user_innvoentiq
      - POSTGRES_PASSWORD=Yahoo000@
    ports:
      - 6000:80
      - 6001:443
      # - 80:80
      # - 443:443

    volumes:
      - ./www/:/var/www/html
      - ./www/demo_app/kml_files:/var/www/html/demo_app/kml_files
      - ./www/demo_app/temp_kml_file:/var/www/html/demo_app/temp_kml_file
      - ./www/demo_app/upload:/var/www/html/demo_app/upload
      - ./data/log:/var/log/apache2

      # - ./data/config/etc/apache2:/etc/apache2
    # command: sh -c 'python manage.py migrate && python manage.py loaddata the_db.json '
    command: sh -c 'wait-for-it db:5432 -- python manage.py makemigrations && python manage.py migrate && python manage.py collectstatic --noinput && python manage.py compilemessages && apache2ctl -D FOREGROUND'
    # command: sh -c 'wait-for-it db:5432 -- python manage.py migrate && python manage.py loaddata last.json && apache2ctl -D FOREGROUND'

    depends_on:
      - db

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật