gliderlabs / docker-alpine

Alpine Linux Docker image. Win at minimalism!
http://gliderlabs.viewdocs.io/docker-alpine
BSD 2-Clause "Simplified" License
5.71k stars 529 forks source link

installing uwsgi using pip fails #158

Closed aljosa closed 8 years ago

aljosa commented 8 years ago

Building an image w/ Dockerfile results in error:

FROM gliderlabs/alpine:3.3

RUN apk-install build-base linux-headers musl musl-dev musl-utils bash python python-dev py-pip
# same thing within virtualenv
RUN pip install uwsgi

alpine linux has a package for uwsgi (patched).

does this mean that uwsgi can't be installed using pip and that this will never be possible?

andyshinn commented 8 years ago

The version you get from the pip install uwsgi won't be patched to work against musl. There are a couple patches that would need to be applied according to the APKBUILD at https://github.com/alpinelinux/aports/tree/ae508f2fde7b2949b917907ef5de2f26178b7cce/main/uwsgi. It is probably a question worth posing upstream to see if they can incorporate these fixes to compile on musl. But in the meantime, you'd need to install via the Alpine package.

Is there some support you are looking for in the Alpine package?

aljosa commented 8 years ago

no support required, it's easier to separate development/deployment if it's in requirements.txt

andrekeller commented 8 years ago

There have been a couple of patches included in uwsgi and they will be released with 2.0.13.

apk add python3-dev build-base linux-headers pcre-dev
pip install https://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip#egg=uwsgi

works for me...

IlyaSemenov commented 8 years ago

This still happens on 2.0.13.1 for me. The worst thing that it's not consistent. Sometimes pip3 install --no-cache-dir --disable-pip-version-check --verbose uwsgi ends with this:

[thread 1][gcc] core/legion.o
[thread 0][gcc] core/dot_h.o
gcc: error trying to exec 'cc1': execvp: No such file or directory
Running setup.py install for uwsgi: finished with status 'error'

sometimes with this:

[thread 0][gcc] core/ssl.o
[thread 1][gcc] core/legion.o
[thread 0][gcc] core/dot_h.o
Running setup.py install for uwsgi: finished with status 'error'

and sometimes it compiles normally:

[thread 0][gcc] core/legion.o
[thread 1][gcc] core/dot_h.o
[thread 1][gcc] core/config_py.o
*** uWSGI compiling embedded plugins ***
[thread 1][gcc] plugins/python/python_plugin.o
[thread 0][gcc] plugins/python/pyutils.o

Any suggestions?

lockie commented 7 years ago

Same problem here. It fails like one in a hundred runs on my machine, and always fails in Gitlab runner on the very same file:

  Running setup.py install for uwsgi: started
    Running setup.py install for uwsgi: finished with status 'error'
    Complete output from command /usr/local/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-tkyxtkpz/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9f9bhyj7-record/install-record.txt --single-version-externally-managed --compile:
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/include']
    Patching "bin_name" to properly install_scripts dir
    detected CPU cores: 2
    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_VERSION="\"2.0.14\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="14" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -DUWSGI_SSL -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(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(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);"
    *** uWSGI compiling server core ***
    [thread 1][gcc] core/utils.o
    [thread 0][gcc] core/protocol.o
    [thread 0][gcc] core/socket.o
    [thread 0][gcc] core/logging.o
    [thread 1][gcc] core/master.o
    [thread 0][gcc] core/master_utils.o
    [thread 1][gcc] core/emperor.o
    [thread 0][gcc] core/notify.o
    [thread 0][gcc] core/mule.o
    [thread 1][gcc] core/subscription.o
    [thread 0][gcc] core/stats.o
    [thread 1][gcc] core/sendfile.o
    [thread 1][gcc] core/async.o
    [thread 0][gcc] core/master_checks.o
    [thread 0][gcc] core/fifo.o
    [thread 1][gcc] core/offload.o
    [thread 0][gcc] core/io.o
    [thread 1][gcc] core/static.o
    [thread 1][gcc] core/websockets.o
    [thread 0][gcc] core/spooler.o
    [thread 1][gcc] core/snmp.o
    [thread 0][gcc] core/exceptions.o
    [thread 1][gcc] core/config.o
    [thread 0][gcc] core/setup_utils.o
    [thread 0][gcc] core/clock.o
    [thread 1][gcc] core/init.o
    [thread 0][gcc] core/buffer.o
    [thread 1][gcc] core/reader.o
    [thread 0][gcc] core/writer.o
    [thread 1][gcc] core/alarm.o
    [thread 0][gcc] core/cron.o
    [thread 1][gcc] core/hooks.o
    [thread 0][gcc] core/plugins.o
    [thread 0][gcc] core/lock.o
    [thread 1][gcc] core/cache.o
    [thread 0][gcc] core/daemons.o
    [thread 0][gcc] core/errors.o
    [thread 0][gcc] core/hash.o
    [thread 1][gcc] core/master_events.o
    [thread 0][gcc] core/chunked.o
    [thread 1][gcc] core/queue.o
    [thread 0][gcc] core/event.o
    [thread 1][gcc] core/signal.o
    [thread 0][gcc] core/strings.o
    [thread 1][gcc] core/progress.o
    [thread 1][gcc] core/timebomb.o
    [thread 0][gcc] core/ini.o
    [thread 1][gcc] core/fsmon.o
    [thread 0][gcc] core/mount.o
    [thread 1][gcc] core/metrics.o
    [thread 0][gcc] core/plugins_builder.o
    [thread 0][gcc] core/sharedarea.o
    [thread 0][gcc] core/rpc.o
    [thread 1][gcc] core/gateway.o
    [thread 0][gcc] core/loop.o
    [thread 1][gcc] core/cookie.o
    [thread 0][gcc] core/querystring.o
    [thread 1][gcc] core/rb_timers.o
    [thread 0][gcc] core/transformations.o
    [thread 1][gcc] core/uwsgi.o
    [thread 0][gcc] proto/base.o
    [thread 0][gcc] proto/uwsgi.o
    [thread 0][gcc] proto/http.o
    [thread 0][gcc] proto/fastcgi.o
    [thread 0][gcc] proto/scgi.o
    [thread 0][gcc] proto/puwsgi.o
    [thread 0][gcc] lib/linux_ns.o
    [thread 1][gcc] core/zlib.o
    [thread 1][gcc] core/yaml.o
    [thread 0][gcc] core/ssl.o
    [thread 1][gcc] core/legion.o
    [thread 0][gcc] core/dot_h.o
    gcc: error trying to exec 'cc1': execvp: No such file or directory
IlyaSemenov commented 7 years ago

@lockie See the uWSGI ticket here: https://github.com/unbit/uwsgi/issues/1318

ZelphirKaltstahl commented 7 years ago

@andrekeller

The installation of uWSGI fails for me with:

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-meVQtF/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-fpetYu-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-meVQtF/uwsgi/
The command '/bin/sh -c pip install https://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip#egg=uwsgi' returned a non-zero code: 1

My whole Dockerfile until that point looks like this:

FROM gliderlabs/alpine:latest

# install system packages
RUN apk add --update --no-cache \
    python \
    python-dev \
    build-base \
    linux-headers \
    pcre-dev \
    py-pip \
    curl \
    openssl \
    nginx \
    rsyslog

# pip
RUN pip install --upgrade pip 
RUN pip install docutils
RUN pip install https://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip#egg=uwsgi

EDIT

Solution: python3-dev was missing and is a requirement for uWSGI.

efagerberg commented 6 years ago

Unfortunately this still seems to not be working, installing uwsgi from pip in the alpine latest image still does not work reliably.

bryanpedini commented 3 years ago

Using python:3.8-alpine image on 2020-10-31 makes it impossible to add uwsgi both with pip's default and with the aforementioned provided GitHub URL.

The error is

/usr/local/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'descriptions'

Full log available here.

jesseinit commented 3 years ago

My Docker File

FROM python:3.8-alpine

WORKDIR /app

ENV VIRTUAL_ENV=/opt/venv

RUN python3 -m venv $VIRTUAL_ENV

# RUN apt-get update && apt-get -y install gcc
# RUN apt-get update && apt-get install -y build-essential
# RUN apk add --no-cache gcc python3-dev
RUN apk add --no-cache gcc libc-dev linux-headers

COPY requirements.txt ./requirements.txt

RUN pip install -r requirements.txt

COPY . .

CMD [ "uwsgi", "--ini", "uwsgi.ini"]

requirements.txt

click==8.0.1
Flask==2.0.1
itsdangerous==2.0.1
Jinja2==3.0.1
MarkupSafe==2.0.1
uWSGI==2.0.19.1
Werkzeug==2.0.1

Uwsgi installs just fine.