質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
docker-compose

docker-composeとは、複数のコンテナで構成されるサービスを提供する手順を自動的し管理を簡単にするツール。composeファイルを使用しコマンド1回で設定した全サービスを作成・起動することが可能です。

Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

uWSGI

uWSGIは、PythonでWebサービスを動かすアプリケーションサーバの一つです。WSGI(Web Server Gateway Interface)アプリケーションコンテナの一種で、WSGIに則ったDjangoやFlaskなどで動かすことができます。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

解決済

1回答

2438閲覧

ERROR: Failed building wheel for uwsgi

perorian

総合スコア0

docker-compose

docker-composeとは、複数のコンテナで構成されるサービスを提供する手順を自動的し管理を簡単にするツール。composeファイルを使用しコマンド1回で設定した全サービスを作成・起動することが可能です。

Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

uWSGI

uWSGIは、PythonでWebサービスを動かすアプリケーションサーバの一つです。WSGI(Web Server Gateway Interface)アプリケーションコンテナの一種で、WSGIに則ったDjangoやFlaskなどで動かすことができます。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2020/09/09 07:40

前提・実現したい

Nginx + Django + DjangoChannels で構成された、Websocket 通信による非同期処理を実装した Web アプリケーションの開発を行っています。
docker for windows, docker-compose でビルドし、既に heroku 上にデプロイし運用しています。
開発環境をビルドし直したところ、正常にビルドできなくなっている状態です。

ディレクトリ構成

※ /project dir
※ | └docker-composer.yml
※ |
※ ├app/
※ | ├django.ini
※ | ├Dockerfile
※ | └requirement.txt
※ |
※ ├web/
※ | ├log/
※ | ├default.conf
※ | ├Dockerfile
※ | ├heroku.conf
※ | └uwsgi_params
※ |
※ ├worker/
※ | └Dockerfile

発生している問題・エラーメッセージ

docker のコンテナ・イメージを全消去し、docker-compose build を叩いたところ以下エラーが出てしまいビルドできない状態です。

Building wheels for collected packages: uwsgi, psycopg2, PyYAML, django-allauth Building wheel for uwsgi (setup.py): started Building wheel for uwsgi (setup.py): finished with status 'error' ERROR: Command errored out with exit status 1: command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o32b_qp1/uwsgi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o32b_qp1/uwsgi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-b7s5zrg4 cwd: /tmp/pip-install-o32b_qp1/uwsgi/ Complete output (125 lines): using profile: buildconf/default.ini detected include path: ['/usr/lib/gcc/x86_64-linux-gnu/8/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed', '/usr/include/x86_64-linux-gnu', '/usr/include'] /usr/local/lib/python3.7/site-packages/setuptools/dist.py:470: UserWarning: The version specified ('2.1-dev-418c0ca1') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details. "details." % version running bdist_wheel running build running build_py creating build creating build/lib copying uwsgidecorators.py -> build/lib installing to build/bdist.linux-x86_64/wheel running install using profile: buildconf/default.ini detected include path: ['/usr/lib/gcc/x86_64-linux-gnu/8/include', '/usr/local/include', '/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed', '/usr/include/x86_64-linux-gnu', '/usr/include'] Patching "bin_name" to properly install_scripts dir detected CPU cores: 1 configured CFLAGS: -O2 -I. -Wall -Werror -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.1-dev-418c0ca1\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="1" -DUWSGI_VERSION_MINOR="0" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"dev-418c0ca1\"" -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);UDEP(router_fcgi);" -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);ULEP(router_fcgi);" *** uWSGI compiling server core *** [gcc -pthread] core/utils.o [gcc -pthread] core/protocol.o [gcc -pthread] core/socket.o [gcc -pthread] core/logging.o [gcc -pthread] core/master.o ========= 省略 =================== [gcc -pthread] core/ssl.o [gcc -pthread] core/legion.o [gcc -pthread] core/xmlconf.o [gcc -pthread] core/dot_h.o [gcc -pthread] core/config_py.o *** uWSGI compiling embedded plugins *** Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-o32b_qp1/uwsgi/setup.py", line 150, in <module> install_requires=get_extra_require() File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/usr/local/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 326, in run self.run_command('install') File "/usr/local/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/tmp/pip-install-o32b_qp1/uwsgi/setup.py", line 78, in run uc.build_uwsgi(conf) File "/tmp/pip-install-o32b_qp1/uwsgi/uwsgiconfig.py", line 463, in build_uwsgi path, up = get_plugin_up(path) File "/tmp/pip-install-o32b_qp1/uwsgi/uwsgiconfig.py", line 1414, in get_plugin_up execfile('%s/uwsgiplugin.py' % path, up) File "/tmp/pip-install-o32b_qp1/uwsgi/uwsgiconfig.py", line 1399, in execfile code = __builtins__.compile(py.read(), path, 'exec') AttributeError: 'dict' object has no attribute 'compile' ---------------------------------------- ERROR: Failed building wheel for uwsgi

該当のソースコード

Dockerfile - Woker

FROM python:3.7 ENV PYTHONUNBUFFERED 1 # Set up project root. RUN mkdir app WORKDIR /app # Install packages before copy sources, for building cache. COPY ./.docker/app/requirements.txt /app/.docker/app/requirements.txt RUN pip install -r /app/.docker/app/requirements.txt # Copy source codes. COPY . /app # Run application servers. # # [celery] Job worker # $ celery -A django_project worker --concurrency=1 -l debug # Attach mode. # $ celery -A django_project worker --detach --pidfile="/path" # Detach mode. CMD celery -A djangdock worker -l info

Dockerfile - app

FROM python:3.7 ENV PYTHONUNBUFFERED 1 # Set up project root. RUN mkdir app WORKDIR /app # Install packages before copy sources, for building cache. COPY ./.docker/app/requirements.txt /app/.docker/app/requirements.txt RUN pip install -r /app/.docker/app/requirements.txt # Copy source codes. COPY . /app # Run application servers. # # [uwsgi] HTTP # $ uwsgi --ini django.ini --master # Attach mode. # $ uwsgi --ini django.ini --master -d /path/to/logfile # Detach mode. # # [uvicorn] WebSocket # $ uvicorn django_project.asgi:application --reload # Hot reload for dev. # $ uvicorn django_project.asgi:application --host 127.0.0.1 --port 8000 # Attach mode. # $ uvicorn django_project.asgi:application --uds /tmp/uvicorn.sock # Using unix socket. # $ uvicorn django_project.asgi:application --ssl-keyfile hoge.key --ssl-certfile hoge.pem # SSL. ARG CREDENTIAL CMD uwsgi --ini /app/.docker/app/django.ini --master -d /dev/stdout && \ uvicorn djangdock.asgi:application --host 0.0.0.0 --port 443 --reload --proxy-headers --ssl-keyfile .credentials/${CREDENTIAL}.key --ssl-certfile .credentials/${CREDENTIAL}.crt

Dockerefile - web

FROM nginx:1.15.6 # Fix settings. ARG DOMAIN ARG CREDENTIAL COPY ./default.conf /etc/nginx/conf.d/default.conf RUN sed -e "s/DOMAIN/${DOMAIN}/g" -i /etc/nginx/conf.d/default.conf RUN sed -e "s/CREDENTIAL/${CREDENTIAL}/g" -i /etc/nginx/conf.d/default.conf RUN cat /etc/nginx/conf.d/default.conf # Run web server. CMD nginx -g "daemon off;"

requirements.txt

ipython django git+https://github.com/unbit/uwsgi.git@master#egg=uwsgi psycopg2 PyYAML dj-database-url django_extensions django-allauth uvicorn >= 0.8.1 channels channels-redis redis celery django-celery-results

試したこと

requirements.txt で git から uwsgi をクローンする記述をコメントアウトし、uwsgi を追加して docker-compose build を実行しました。
すると uwsgi 自体のビルドはできるのですが、docker-compose up するとコンソールに下記メッセージが出続けてしまいます。

uwsgi_check_logrotate()/lseek(): Illegal seek [core/logging.c line 494]

上記を避けるため、requirements.txt にて git から uwsgi をクローンしています。
https://github.com/unbit/uwsgi/pull/1855

エラー文に AttributeError: 'dict' object has no attribute 'compile' と出るのですが、該当する記事もなく具体的な解決方法を見つけることが出来ていない状態です。

補足情報(FW/ツールのバージョンなど)

platform
  • docker 19.03.1
  • docker-compose 1.24.1
back-end
  • nginx 1.15.6
  • postgres 11
  • redis 5.0.3
  • python 3.7
  • django 2.2.1
  • django/channels
  • django-celery-results
  • uwsgi
  • uvicorn
  • celery

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

requirements.txt にてバージョン管理していない Python ライブラリの競合によるビルドエラーでした。
ひとつひとつライブラリのバージョンと動作を確認することで解決しました。

投稿2020/11/04 00:37

perorian

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問