Hello! Trying to install uvloop in a python app within a docker image.
I am currently getting the following errors (below).
PYTHONASYNCIODEBUG in env?:unable to install uvloop in docker, the same configuration works outside of the container.
requirements.txt:
asyncio
uvloop
asyncpg
Dockerfile:
RUN python3 -m pip install -r requirements.txt
Error:
Collecting uvloop (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/d4/50/385f5dfd008508750a255ae742aaea6cc7f58877d9444b2d759543b0ee72/uvloop-0.10.1.tar.gz (1.9MB)
Collecting asyncpg==0.16.0 (from -r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/89/62/6d218bc7d1412b837ed6f006a42a660fc970c3135c22c55f2370a93e11d4/asyncpg-0.16.0.tar.gz (615kB)
Complete output from command python setup.py egg_info:
error in asyncpg setup command: 'extras_require' requirements cannot include environment markers, in 'test': 'uvloop>=0.8.0; platform_system != "Windows"'
again, the same requirements file work outside of docker (mac os + python 3.6)
Try pip install -U setuptools pip before.
Probably Cython needs to be installed before installing uvloop.
Probably Cython needs to be installed before installing uvloop.
No. Cython is only used during the sdist/bdist phases. It's not a runtime dependancy.
Closing this issue.
Im having this issue the image is and as you can see im updating setuptools and pip before trying to install from requirements.
FROM python:3.7.0-alpine3.8
RUN apk update \
&& apk add python3 postgresql-libs \
&& apk add --update --no-cache --virtual .build-deps alpine-sdk python3-dev musl-dev postgresql-dev libffi-dev \
&& pip install -U setuptools pip \
&& pip install --no-cache-dir -r /requirements/local.txt \
&& rm -rf /requirements \
&& apk --purge del .build-deps
This is where it freezes
Downloading https://files.pythonhosted.org/packages/5c/37/6daa39aac42b2deda6ee77f408bec0419b600e27b89b374b0d440af32b10/uvloop-0.11.2.tar.gz (1.9MB)
Downloading from URL https://files.pythonhosted.org/packages/5c/37/6daa39aac42b2deda6ee77f408bec0419b600e27b89b374b0d440af32b10/uvloop-0.11.2.tar.gz#sha256=a97bd62ebbdf7e6e84bf44afe439d9b24ce4d8661a29a639626a8c03748f6f98 (from https://pypi.org/simple/uvloop/)
Ignoring unknown cache-control directive: immutable
Updating cache with response from "https://files.pythonhosted.org/packages/5c/37/6daa39aac42b2deda6ee77f408bec0419b600e27b89b374b0d440af32b10/uvloop-0.11.2.tar.gz"
Caching due to etag
Added uvloop from https://files.pythonhosted.org/packages/5c/37/6daa39aac42b2deda6ee77f408bec0419b600e27b89b374b0d440af32b10/uvloop-0.11.2.tar.gz#sha256=a97bd62ebbdf7e6e84bf44afe439d9b24ce4d8661a29a639626a8c03748f6f98 to build tracker '/tmp/pip-req-tracker-ake3ksvf'
Running setup.py (path:/tmp/pip-install-iqezhk3g/uvloop/setup.py) egg_info for package uvloop
Running command python setup.py egg_info
running egg_info
creating pip-egg-info/uvloop.egg-info
writing pip-egg-info/uvloop.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/uvloop.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/uvloop.egg-info/top_level.txt
writing manifest file 'pip-egg-info/uvloop.egg-info/SOURCES.txt'
reading manifest file 'pip-egg-info/uvloop.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'vendor/libuv/.git'
warning: no previously-included files matching '*' found under directory 'vendor/libuv/docs'
warning: no previously-included files matching '*' found under directory 'vendor/libuv/img'
writing manifest file 'pip-egg-info/uvloop.egg-info/SOURCES.txt'
Source in /tmp/pip-install-iqezhk3g/uvloop has version 0.11.2, which satisfies requirement uvloop from https://files.pythonhosted.org/packages/5c/37/6daa39aac42b2deda6ee77f408bec0419b600e27b89b374b0d440af32b10/uvloop-0.11.2.tar.gz#sha256=a97bd62ebbdf7e6e84bf44afe439d9b24ce4d8661a29a639626a8c03748f6f98
Removed uvloop from https://files.pythonhosted.org/packages/5c/37/6daa39aac42b2deda6ee77f408bec0419b600e27b89b374b0d440af32b10/uvloop-0.11.2.tar.gz#sha256=a97bd62ebbdf7e6e84bf44afe439d9b24ce4d8661a29a639626a8c03748f6f98 from build tracker '/tmp/pip-req-tracker-ake3ksvf'
Building wheels for collected packages: uvloop
Created temporary directory: /tmp/pip-wheel-dl4xx4sw
Running setup.py bdist_wheel for uvloop: started
Destination directory: /tmp/pip-wheel-dl4xx4sw
Running command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-iqezhk3g/uvloop/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-dl4xx4sw --python-tag cp37
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/uvloop
copying uvloop/__init__.py -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/_patch.py -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/_testbase.py -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/_noop.py -> build/lib.linux-x86_64-3.7/uvloop
running egg_info
writing uvloop.egg-info/PKG-INFO
writing dependency_links to uvloop.egg-info/dependency_links.txt
writing top-level names to uvloop.egg-info/top_level.txt
reading manifest file 'uvloop.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'vendor/libuv/.git'
warning: no previously-included files matching '*' found under directory 'vendor/libuv/docs'
warning: no previously-included files matching '*' found under directory 'vendor/libuv/img'
writing manifest file 'uvloop.egg-info/SOURCES.txt'
copying uvloop/cbhandles.pxd -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/cbhandles.pyx -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/dns.pyx -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/errors.pyx -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/loop.c -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/loop.pxd -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/loop.pyx -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/pseudosock.pyx -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/request.pxd -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/request.pyx -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/server.pxd -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/server.pyx -> build/lib.linux-x86_64-3.7/uvloop
copying uvloop/sslproto.pyx -> build/lib.linux-x86_64-3.7/uvloop
creating build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/async_.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/async_.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/basetransport.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/basetransport.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/check.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/check.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/handle.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/handle.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/idle.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/idle.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/pipe.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/pipe.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/poll.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/poll.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/process.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/process.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/stream.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/stream.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/streamserver.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/streamserver.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/tcp.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/tcp.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/timer.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/timer.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/udp.pxd -> build/lib.linux-x86_64-3.7/uvloop/handles
copying uvloop/handles/udp.pyx -> build/lib.linux-x86_64-3.7/uvloop/handles
creating build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/__init__.py -> build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/compat.h -> build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/consts.pxi -> build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/debug.h -> build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/debug.pxd -> build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/python.pxd -> build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/stdlib.pxi -> build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/system.pxd -> build/lib.linux-x86_64-3.7/uvloop/includes
copying uvloop/includes/uv.pxd -> build/lib.linux-x86_64-3.7/uvloop/includes
running build_ext
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking if gcc supports -pedantic flag... yes
checking for gcc way to treat warnings as errors... -Werror
checking if gcc supports -fvisibility=hidden... yes
checking if gcc supports -g flag... yes
checking if gcc supports -std=gnu89 flag... yes
checking if gcc supports -Wall flag... yes
checking if gcc supports -Wextra flag... yes
checking if gcc supports -Wno-unused-parameter flag... yes
checking if gcc supports -Wstrict-prototypes flag... yes
checking for ar... ar
checking the archiver (ar) interface... ar
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 98304
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... no
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether make supports nested variables... (cached) yes
checking for dlopen in -ldl... yes
checking for kstat_lookup in -lkstat... no
checking for gethostbyname in -lnsl... no
checking for perfstat_cpu in -lperfstat... no
checking for pthread_mutex_init in -lpthread... yes
checking for clock_gettime in -lrt... yes
checking for sendfile in -lsendfile... no
checking for socket in -lsocket... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking sys/ahafs_evProds.h usability... no
checking sys/ahafs_evProds.h presence... no
checking for sys/ahafs_evProds.h... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libuv.pc
config.status: executing depfiles commands
config.status: executing libtool commands
CC src/unix/libuv_la-async.lo
CC src/unix/libuv_la-core.lo
CC src/unix/libuv_la-dl.lo
CC src/unix/libuv_la-fs.lo
CC src/unix/libuv_la-getaddrinfo.lo
CC src/unix/libuv_la-loop-watcher.lo
CC src/unix/libuv_la-getnameinfo.lo
CC src/unix/libuv_la-loop.lo
CC src/unix/libuv_la-pipe.lo
CC src/unix/libuv_la-poll.lo
CC src/unix/libuv_la-process.lo
CC src/unix/libuv_la-signal.lo
CC src/unix/libuv_la-stream.lo
CC src/unix/libuv_la-tcp.lo
CC src/unix/libuv_la-thread.lo
CC src/unix/libuv_la-timer.lo
CC src/unix/libuv_la-tty.lo
CC src/unix/libuv_la-udp.lo
CC src/unix/libuv_la-linux-core.lo
CC src/unix/libuv_la-linux-inotify.lo
CC src/unix/libuv_la-linux-syscalls.lo
CC src/unix/libuv_la-procfs-exepath.lo
CC src/unix/libuv_la-proctitle.lo
CC src/unix/libuv_la-sysinfo-loadavg.lo
CC src/unix/libuv_la-sysinfo-memory.lo
CC src/libuv_la-fs-poll.lo
CC src/libuv_la-inet.lo
CC src/libuv_la-threadpool.lo
CC src/libuv_la-uv-data-getter-setters.lo
CC src/libuv_la-uv-common.lo
CC src/libuv_la-version.lo
CCLD libuv.la
ar: `u' modifier ignored since `D' is the default (see `U')
building 'uvloop.loop' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/uvloop
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.7m -I/tmp/pip-install-iqezhk3g/uvloop/vendor/libuv/include -c uvloop/loop.c -o build/temp.linux-x86_64-3.7/uvloop/loop.o -O2
uvloop/loop.c: In function '__pyx_f_6uvloop_4loop_9UVProcess__after_fork':
uvloop/loop.c:107423:3: warning: 'PyOS_AfterFork' is deprecated [-Wdeprecated-declarations]
PyOS_AfterFork();
^~~~~~~~~~~~~~
In file included from /usr/local/include/python3.7m/Python.h:125:0,
from uvloop/loop.c:20:
/usr/local/include/python3.7m/intrcheck.h:18:18: note: declared here
PyAPI_FUNC(void) PyOS_AfterFork(void) Py_DEPRECATED(3.7);
^~~~~~~~~~~~~~
Run this command to recreate issue:
docker run python:3.7 pip install uvloop==0.8
As a workaround, you can either use python 3.6 instead:
docker run python:3.6 pip install uvloop==0.8
Or you can update uvloop to at least v0.9:
docker run python:3.7 pip install uvloop==0.9
@1st1 is there another issue that addresses this topic? The issue got closed without addressing the main problem at all.
The original issue is a setuptools bug. Do a pip install -U setuptools before installing uvloop.
The original issue is a setuptools bug. Do a
pip install -U setuptoolsbefore installing uvloop.
It doesn't solve the problem for me :/
this worked for me
apk add build-base
this worked for me
apk add build-base
This should be in somewhere in the documentation as a requirement for using uvloop in alpine docker images
Try
pip install -U setuptools pipbefore.
thank you very much
this worked for me
apk add build-base
Is it mandatory for running the app (with uvloop.install()) or could be deleted following pip install uvloop?
Most helpful comment
this worked for me
apk add build-base