skip to Main Content

When I add uWSGI==2.0.19.1 into my requirements.txt, then run docker-compose build, it failed. Already searched for a while, seems there are no such familiar cases like this. Here are my files. Feel free to share your idea, tks.


requirements.txt

...

uWSGI==2.0.19.1

...

logs

#8 20.69   Building wheel for tornado (setup.py): started
#8 21.43   Building wheel for tornado (setup.py): finished with status 'done'
#8 21.43   Created wheel for tornado: filename=tornado-6.1-cp310-cp310-linux_x86_64.whl size=421785 sha256=91e3761aa2ff9fb8e87ea1a0e2efad0e62db3fa2ddd419ceab9d01b3621db4cf
#8 21.43   Stored in directory: /root/.cache/pip/wheels/80/32/8d/21cf0fa6ee4e083f6530e5b83dfdfa9489a3890d320803f4c7
#8 21.43   Building wheel for uWSGI (setup.py): started
#8 24.36   Building wheel for uWSGI (setup.py): finished with status 'error'
#8 24.37   error: subprocess-exited-with-error
#8 24.37
#8 24.37   × python setup.py bdist_wheel did not run successfully.
#8 24.37   │ exit code: 1
#8 24.37   ╰─> [88 lines of output]
#8 24.37       /usr/local/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'descriptions'
#8 24.37         warnings.warn(msg)
#8 24.37       running bdist_wheel
#8 24.37       running build
#8 24.37       running build_py
#8 24.37       creating build
#8 24.37       creating build/lib
#8 24.37       copying uwsgidecorators.py -> build/lib
#8 24.37       warning: build_py: byte-compiling is disabled, skipping.
#8 24.37
#8 24.37       installing to build/bdist.linux-x86_64/wheel
#8 24.37       running install
#8 24.37       using profile: buildconf/default.ini
#8 24.37       detected include path: ['/usr/lib/gcc/x86_64-linux-gnu/10/include', '/usr/local/include', '/usr/include/x86_64-linux-gnu', '/usr/include']
#8 24.37       Patching "bin_name" to properly install_scripts dir
#8 24.37       detected CPU cores: 8
#8 24.37       configured CFLAGS: -O2 -I. -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY  -DUWSGI_PCRE -DUWSGI_ROUTING -DUWSGI_UUID -DUWSGI_VERSION=""2.0.19.1"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="19" -DUWSGI_VERSION_REVISION="1" -DUWSGI_VERSION_CUSTOM="""" -DUWSGI_YAML -DUWSGI_SSL -I/usr/include/libxml2 -DUWSGI_XML -DUWSGI_XML_LIBXML2 -DUWSGI_PLUGIN_DIR=""."" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(ugreen);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(ugreen);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);"
#8 24.37       *** uWSGI compiling server core ***
#8 24.37       [thread 1][gcc -pthread] core/utils.o
#8 24.37       [thread 3][gcc -pthread] core/protocol.o
#8 24.37       [thread 2][gcc -pthread] core/socket.o
#8 24.37       [thread 4][gcc -pthread] core/logging.o
#8 24.37       [thread 0][gcc -pthread] core/master.o

...


#8 27.65       python_plugin.c:(.text+0x1652): undefined reference to `PyParser_SimpleParseString'
#8 27.65       /usr/bin/ld: python_plugin.c:(.text+0x1667): undefined reference to `PyNode_Compile'
#8 27.65       /usr/bin/ld: python_plugin.c:(.text+0x171b): undefined reference to `PyParser_SimpleParseFile'
#8 27.65       /usr/bin/ld: python_plugin.c:(.text+0x173b): undefined reference to `PyNode_Compile'
#8 27.65       /usr/bin/ld: python_plugin.c:(.text+0x17b3): undefined reference to `PyParser_SimpleParseFile'
#8 27.65       /usr/bin/ld: python_plugin.c:(.text+0x17d3): undefined reference to `PyNode_Compile'
#8 27.65       /usr/bin/ld: plugins/python/pyloader.o: in function `uwsgi_eval_loader':
#8 27.65       pyloader.c:(.text+0x170f): undefined reference to `PyParser_SimpleParseString'
#8 27.65       /usr/bin/ld: pyloader.c:(.text+0x1728): undefined reference to `PyNode_Compile'
#8 27.65       collect2: error: ld returned 1 exit status
#8 27.65       *** error linking uWSGI ***
#8 27.65       [end of output]
#8 27.65
#8 27.65   note: This error originates from a subprocess, and is likely not a problem with pip.
#8 27.65 error: legacy-install-failure
#8 27.65
#8 27.65 × Encountered error while trying to install package.
#8 27.65 ╰─> uWSGI
#8 27.65
#8 27.65 note: This is an issue with the package mentioned above, not pip.
#8 27.65 hint: See above for output from the failure.
#8 27.96 WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
#8 27.96 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 1
ERROR: Service 'web' failed to build : Build failed

Dockerfile

FROM python:3

ENV PYTHONDONTWRITEBYTECODE=1

ENV PYTHONUNBUFFERED=1

WORKDIR /code

COPY requirements.txt /code/

RUN pip install -r requirements.txt

COPY . /code/

docker-compose.yml

version: "3.9"

services:

  db:
    image: postgres
    volumes:
      - postgres:/var/lib/postgresql/data
    environment:
      - POSTGRES_NAME=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

  web:
    build: ./web
    restart: always
    volumes:
      - ./web:/code
    ports:
      - "8000:8000"
    environment:
      - DEBUG=True
      - CELERY_BROKER_URL=redis://redis:6379/0
      - CELERY_RESULT_BACKEND=redis://redis:6379/0
      - POSTGRES_NAME=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

    depends_on:
      - db
    entrypoint: /code/entrypoint.sh


  celery:
    build: ./web
    restart: always
    volumes:
      - ./web:/code
    depends_on:
      - web
      - redis
      - db
    links:
      - redis:redis
    command: celery -A demo worker -l info
    environment:
      - DEBUG=True
      - CELERY_BROKER_URL=redis://redis:6379/0
      - CELERY_RESULT_BACKEND=redis://redis:6379/0
      - POSTGRES_NAME=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres


  redis:
    image: redis:alpine


  nginx:
    image: nginx
    build: ./nginx
    restart: always
    ports:
      - "80:80"
    volumes:
      - ./web:/code
      - ./nginx/log:/var/log/nginx
    depends_on:
      - web


volumes:
  postgres:

2

Answers


  1. uWSGI has multiple dependencies which should be available before installation. I prefer to use a readily available ubuntu base image with the minor modification possible.

    FROM ubuntu:18.04
    RUN apt update && 
     apt install -y vim && 
     apt-get install -y python3-pip && 
     apt install gcc && 
     pip3 install uwsgi 
    
    Login or Signup to reply.
  2. For me, I had FROM python:3.11-alpine in my Dockerfile which didn’t include all the necessary dependencies to build uwsgi. When switching to FROM python:3.11, it built fine for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search