Python: a gcc problem of pip install in alpine and slim

Created on 26 Jul 2018  ·  11Comments  ·  Source: docker-library/python

first, it's ok in 3.7.0-stretch 17453243214e. even i upgrade pip 10 => 18.
docker_py_about_gcc_promblem.txt

and it appear in alpine 4ba354cfad11 and slim 721e295edabf.

error is :
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yu7dnntc/greenlet/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-record-lqpautx_/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-yu7dnntc/greenlet/

my dockerfile is
FROM python:3.7.0-stretch WORKDIR /usr/mabo/ COPY ./requirements.txt ./ RUN pip install -r requirements.txt \ && rm requirements.txt

and requirements is :
zope.interface constantly incremental attrs Automat twisted pymodbus3 pendulum redis influxdb msgpack-python toml python-etcd falcon waitress greenlet gevent logbook

in alpine,it's error in install greenlet.
in slim ,it's same.

and in alpine, only pip greenlet, also error.

but when i change dockerfile ,and use it in slim
RUN pip install greenlet RUN pip install -r mabopython_requirements_alpine.txt \ && rm mabopython_requirements_alpine.txt

error is different:
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_xu8ni82/twisted/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-record-_yicobwz/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-_xu8ni82/twisted/

not greenlet is twisted..Orz

question

Most helpful comment

@wglambert #312 (comment)
the way of intall gcc,is very usefully thanks.

RUN apk add --no-cache --virtual .build-deps gcc musl-dev
RUN pip install cython
RUN apk del .build-deps gcc musl-dev

All 11 comments

more info:

【run in python:3.7.0-alpine
Running setup.py clean for greenlet
Failed building wheel for greenlet
Successfully built logbook zope.interface pymodbus3 pendulum msgpack-python toml python-etcd
Failed to build gevent twisted greenlet
Installing collected packages: greenlet, gevent, logbook, zope.interface, constantly, incremental, attrs, six, Automat, idna, hyperlink, PyHamcrest, twisted, pyserial, pymodbus3, python-dateutil, pytzdata, pendulum, redis, pytz, certifi, chardet, urllib3, requests, influxdb, msgpack-python, toml, dnspython, python-etcd, python-mimeparse, falcon, waitress
Running setup.py install for greenlet: started
Running setup.py install for greenlet: finished with status 'error'
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yu7dnntc/greenlet/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-record-lqpautx_/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'greenlet' extension
creating build
creating build/temp.linux-x86_64-3.7
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.7m -c greenlet.c -o build/temp.linux-x86_64-3.7/greenlet.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yu7dnntc/greenlet/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-record-lqpautx_/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-yu7dnntc/greenlet/
The command '/bin/sh -c pip install -r mabopython_requirements.txt && rm mabopython_requirements.txt' returned a non-zero code: 1

【run in alpine,and just greenlet】
Running setup.py clean for greenlet
Failed building wheel for greenlet
Failed to build greenlet
Installing collected packages: greenlet
Running setup.py install for greenlet: started
Running setup.py install for greenlet: finished with status 'error'
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ouipj7nz/greenlet/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-record-587ux85p/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'greenlet' extension
creating build
creating build/temp.linux-x86_64-3.7
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.7m -c greenlet.c -o build/temp.linux-x86_64-3.7/greenlet.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ouipj7nz/greenlet/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-record-587ux85p/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ouipj7nz/greenlet/

【run in slim,first install greenlet,then other】
copying src/twisted/names/test/test_util.py -> build/lib.linux-x86_64-3.7/twisted/names/test
copying src/twisted/names/test/test_server.py -> build/lib.linux-x86_64-3.7/twisted/names/test
copying src/twisted/names/test/test_tap.py -> build/lib.linux-x86_64-3.7/twisted/names/test
copying src/twisted/names/test/test_rfc1982.py -> build/lib.linux-x86_64-3.7/twisted/names/test
copying src/twisted/names/test/test_resolve.py -> build/lib.linux-x86_64-3.7/twisted/names/test
copying src/twisted/names/test/test_examples.py -> build/lib.linux-x86_64-3.7/twisted/names/test
running egg_info
writing src/Twisted.egg-info/PKG-INFO
writing dependency_links to src/Twisted.egg-info/dependency_links.txt
writing entry points to src/Twisted.egg-info/entry_points.txt
writing requirements to src/Twisted.egg-info/requires.txt
writing top-level names to src/Twisted.egg-info/top_level.txt
reading manifest file 'src/Twisted.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '.misc' found under directory 'src/twisted'
warning: no previously-included files matching '
.bugfix' found under directory 'src/twisted'
warning: no previously-included files matching '.doc' found under directory 'src/twisted'
warning: no previously-included files matching '
.feature' found under directory 'src/twisted'
warning: no previously-included files matching '.removal' found under directory 'src/twisted'
warning: no previously-included files matching 'NEWS' found under directory 'src/twisted'
warning: no previously-included files matching 'README' found under directory 'src/twisted'
warning: no previously-included files matching 'newsfragments' found under directory 'src/twisted'
warning: no previously-included files found matching 'src/twisted/topfiles/CREDITS'
warning: no previously-included files found matching 'src/twisted/topfiles/ChangeLog.Old'
warning: no previously-included files found matching 'pyproject.toml'
warning: no previously-included files found matching 'codecov.yml'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching '.circleci'
warning: no previously-included files matching '
' found under directory '.circleci'
no previously-included directories found matching 'bin'
no previously-included directories found matching 'admin'
no previously-included directories found matching '.travis'
no previously-included directories found matching '.github'
warning: no previously-included files found matching 'docs/historic/2003'
warning: no previously-included files matching '*' found under directory 'docs/historic/2003'
writing manifest file 'src/Twisted.egg-info/SOURCES.txt'
copying src/twisted/python/twisted-completion.zsh -> build/lib.linux-x86_64-3.7/twisted/python
creating build/lib.linux-x86_64-3.7/twisted/python/_pydoctortemplates
copying src/twisted/python/_pydoctortemplates/common.html -> build/lib.linux-x86_64-3.7/twisted/python/_pydoctortemplates
copying src/twisted/python/_pydoctortemplates/index.html -> build/lib.linux-x86_64-3.7/twisted/python/_pydoctortemplates
copying src/twisted/python/_pydoctortemplates/summary.html -> build/lib.linux-x86_64-3.7/twisted/python/_pydoctortemplates
copying src/twisted/test/cert.pem.no_trailing_newline -> build/lib.linux-x86_64-3.7/twisted/test
copying src/twisted/test/key.pem.no_trailing_newline -> build/lib.linux-x86_64-3.7/twisted/test
copying src/twisted/test/server.pem -> build/lib.linux-x86_64-3.7/twisted/test
copying src/twisted/python/test/_deprecatetests.py.3only -> build/lib.linux-x86_64-3.7/twisted/python/test
copying src/twisted/internet/test/_awaittests.py.3only -> build/lib.linux-x86_64-3.7/twisted/internet/test
copying src/twisted/internet/test/_yieldfromtests.py.3only -> build/lib.linux-x86_64-3.7/twisted/internet/test
creating build/lib.linux-x86_64-3.7/twisted/internet/test/fake_CAs
copying src/twisted/internet/test/fake_CAs/chain.pem -> build/lib.linux-x86_64-3.7/twisted/internet/test/fake_CAs
copying src/twisted/internet/test/fake_CAs/not-a-certificate -> build/lib.linux-x86_64-3.7/twisted/internet/test/fake_CAs
copying src/twisted/internet/test/fake_CAs/thing1.pem -> build/lib.linux-x86_64-3.7/twisted/internet/test/fake_CAs
copying src/twisted/internet/test/fake_CAs/thing2-duplicate.pem -> build/lib.linux-x86_64-3.7/twisted/internet/test/fake_CAs
copying src/twisted/internet/test/fake_CAs/thing2.pem -> build/lib.linux-x86_64-3.7/twisted/internet/test/fake_CAs
copying src/twisted/internet/iocpreactor/notes.txt -> build/lib.linux-x86_64-3.7/twisted/internet/iocpreactor
copying src/twisted/mail/test/rfc822.message -> build/lib.linux-x86_64-3.7/twisted/mail/test
copying src/twisted/words/im/instancemessenger.glade -> build/lib.linux-x86_64-3.7/twisted/words/im
copying src/twisted/words/xish/xpathparser.g -> build/lib.linux-x86_64-3.7/twisted/words/xish
running build_ext
building 'twisted.test.raiser' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
creating build/temp.linux-x86_64-3.7/src/twisted
creating build/temp.linux-x86_64-3.7/src/twisted/test
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c src/twisted/test/raiser.c -o build/temp.linux-x86_64-3.7/src/twisted/test/raiser.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_xu8ni82/twisted/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-record-_yicobwz/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-_xu8ni82/twisted/
The command '/bin/sh -c pip install -r mabopython_requirements_alpine.txt && rm mabopython_requirements_alpine.txt' returned a non-zero code: 1

unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

You should install build required packages.

https://pip.pypa.io/en/stable/reference/pip_wheel/#options

I'm not very familiar with python, it seems it doesn't have an option for accepting a file as a list of packages. -i, -f, -r, do not process the file as you want them to. However putting them in the Dockerfile directly will work.

FROM python:3.7.0-stretch

RUN pip install zope.interface constantly incremental attrs Automat twisted pymodbus3 pendulum redis influxdb msgpack-python toml python-etcd falcon waitress greenlet gevent logbook


docker build

$ docker build . -t python_test
Sending build context to Docker daemon  3.072kB
Step 1/2 : FROM python:3.7.0-stretch
 ---> 638817465c7d
Step 2/2 : RUN pip install zope.interface constantly incremental attrs Automat twisted pymodbus3 pendulum redis influxdb msgpack-python toml python-etcd falcon waitress greenlet gevent logbook
 ---> Running in 3e97bb30b380
Collecting zope.interface
  Downloading https://files.pythonhosted.org/packages/ac/8a/657532df378c2cd2a1fe6b12be3b4097521570769d4852ec02c24bd3594e/zope.interface-4.5.0.tar.gz (151kB)
Collecting constantly
  Downloading https://files.pythonhosted.org/packages/b9/65/48c1909d0c0aeae6c10213340ce682db01b48ea900a7d9fce7a7910ff318/constantly-15.1.0-py2.py3-none-any.whl
Collecting incremental
  Downloading https://files.pythonhosted.org/packages/f5/1d/c98a587dc06e107115cf4a58b49de20b19222c83d75335a192052af4c4b7/incremental-17.5.0-py2.py3-none-any.whl
Collecting attrs
  Downloading https://files.pythonhosted.org/packages/41/59/cedf87e91ed541be7957c501a92102f9cc6363c623a7666d69d51c78ac5b/attrs-18.1.0-py2.py3-none-any.whl
Collecting Automat
  Downloading https://files.pythonhosted.org/packages/a3/86/14c16bb98a5a3542ed8fed5d74fb064a902de3bdd98d6584b34553353c45/Automat-0.7.0-py2.py3-none-any.whl
Collecting twisted
  Downloading https://files.pythonhosted.org/packages/90/50/4c315ce5d119f67189d1819629cae7908ca0b0a6c572980df5cc6942bc22/Twisted-18.7.0.tar.bz2 (3.1MB)
Collecting pymodbus3
  Downloading https://files.pythonhosted.org/packages/9e/e4/e1c1b243203891e76bd0af519cabc9fb0df5dac1e36074a3e3aa62ec2efb/pymodbus3-1.0.0.tar.gz (80kB)
Collecting pendulum
  Downloading https://files.pythonhosted.org/packages/4a/97/c288b8c98e49b9e1ec67b28ada3f39b7bd786be11ca119244e2aca3a5cf4/pendulum-2.0.2.tar.gz (75kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
Collecting redis
  Downloading https://files.pythonhosted.org/packages/3b/f6/7a76333cf0b9251ecf49efff635015171843d9b977e4ffcf59f9c4428052/redis-2.10.6-py2.py3-none-any.whl (64kB)
Collecting influxdb
  Downloading https://files.pythonhosted.org/packages/3b/62/462d9b3675d9df3255d317d36076cfb1ae83042920a9b79e3b14d752f511/influxdb-5.2.0-py2.py3-none-any.whl (71kB)
Collecting msgpack-python
  Downloading https://files.pythonhosted.org/packages/8a/20/6eca772d1a5830336f84aca1d8198e5a3f4715cd1c7fc36d3cc7f7185091/msgpack-python-0.5.6.tar.gz (138kB)
Collecting toml
  Downloading https://files.pythonhosted.org/packages/f5/f9/044110c267e6408013b85166a7cfcd352cf85275aa8ce700aa5c0eb407ba/toml-0.9.4.tar.gz
Collecting python-etcd
  Downloading https://files.pythonhosted.org/packages/a1/da/616a4d073642da5dd432e5289b7c1cb0963cc5dde23d1ecb8d726821ab41/python-etcd-0.4.5.tar.gz
Collecting falcon
  Downloading https://files.pythonhosted.org/packages/e8/d0/20bb807dee65f1f163754670557b128eafce1710f6c9c363a38e357f3783/falcon-1.4.1-py2.py3-none-any.whl (159kB)
Collecting waitress
  Downloading https://files.pythonhosted.org/packages/ee/af/ac32a716d64e56561ee9c23ce45ee2865d7ac4e0678b737d2f5ee49b5fd6/waitress-1.1.0-py2.py3-none-any.whl (114kB)
Collecting greenlet
  Downloading https://files.pythonhosted.org/packages/e9/95/4c9d2be16c124cb8e1b19b1b5c9811b5e43c3a60d2f4355e42d30813bda4/greenlet-0.4.14-cp37-cp37m-manylinux1_x86_64.whl (42kB)
Collecting gevent
  Downloading https://files.pythonhosted.org/packages/59/cc/11c0962cfef3ce807f9964b5f4621de3b1d1ed28e07fb5244333d477ac55/gevent-1.3.5-cp37-cp37m-manylinux1_x86_64.whl (4.5MB)
Collecting logbook
  Downloading https://files.pythonhosted.org/packages/36/4b/b610bee18d5cfc4cec7dde056639994e9b34991e4c57816bfff0f3d0ac33/Logbook-1.4.0.tar.gz (84kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from zope.interface) (40.0.0)
Collecting six (from Automat)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting hyperlink>=17.1.1 (from twisted)
  Downloading https://files.pythonhosted.org/packages/a7/b6/84d0c863ff81e8e7de87cff3bd8fd8f1054c227ce09af1b679a8b17a9274/hyperlink-18.0.0-py2.py3-none-any.whl
Collecting PyHamcrest>=1.9.0 (from twisted)
  Downloading https://files.pythonhosted.org/packages/9a/d5/d37fd731b7d0e91afcc84577edeccf4638b4f9b82f5ffe2f8b62e2ddc609/PyHamcrest-1.9.0-py2.py3-none-any.whl (52kB)
Collecting pyserial>=2.6 (from pymodbus3)
  Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
Collecting python-dateutil<3.0,>=2.6 (from pendulum)
  Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB)
Collecting pytzdata>=2018.3 (from pendulum)
  Downloading https://files.pythonhosted.org/packages/2b/b8/a007eedc118838b27247da7c31f25c2b9e68e68ed2ffafed3d340d379e84/pytzdata-2018.5-py2.py3-none-any.whl (981kB)
Collecting pytz (from influxdb)
  Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl (510kB)
Collecting requests>=2.17.0 (from influxdb)
  Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB)
Collecting urllib3>=1.7.1 (from python-etcd)
  Downloading https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl (133kB)
Collecting dnspython>=1.13.0 (from python-etcd)
  Downloading https://files.pythonhosted.org/packages/a6/72/209e18bdfedfd78c6994e9ec96981624a5ad7738524dd474237268422cb8/dnspython-1.15.0-py2.py3-none-any.whl (177kB)
Collecting python-mimeparse>=1.5.2 (from falcon)
  Downloading https://files.pythonhosted.org/packages/26/2e/03bce213a9bf02a2750dcb04e761785e9c763fc11071edc4b447eacbb842/python_mimeparse-1.6.0-py2.py3-none-any.whl
Collecting idna>=2.5 (from hyperlink>=17.1.1->twisted)
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.17.0->influxdb)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting certifi>=2017.4.17 (from requests>=2.17.0->influxdb)
  Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
Building wheels for collected packages: zope.interface, twisted, pymodbus3, pendulum, msgpack-python, toml, python-etcd, logbook
  Running setup.py bdist_wheel for zope.interface: started
  Running setup.py bdist_wheel for zope.interface: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/c6/b2/d2/be6785a207eaa58d76debc10c9d5c66196b40a88abb61d6af7
  Running setup.py bdist_wheel for twisted: started
  Running setup.py bdist_wheel for twisted: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/a9/85/24/fc82998fb686cb31e65a26c027a20120fd1219c9f1e925913a
  Running setup.py bdist_wheel for pymodbus3: started
  Running setup.py bdist_wheel for pymodbus3: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/52/a0/72/5317456c51d8b81978e8cd6c23f5e5fe7aefebd2732744ddc7
  Running setup.py bdist_wheel for pendulum: started
  Running setup.py bdist_wheel for pendulum: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/06/6d/9e/7ff661dff4df0ee3783bd032f6ea28f1ec78271e0711941dd4
  Running setup.py bdist_wheel for msgpack-python: started
  Running setup.py bdist_wheel for msgpack-python: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/d5/de/86/7fa56fda12511be47ea0808f3502bc879df4e63ab168ec0406
  Running setup.py bdist_wheel for toml: started
  Running setup.py bdist_wheel for toml: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/60/a0/8a/eaebd461aa0abf3d38546b12f3b3234de0a39de13374dad39e
  Running setup.py bdist_wheel for python-etcd: started
  Running setup.py bdist_wheel for python-etcd: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/65/07/b7/da66f9ca9985154db8940f616e15f06e1c7fbfeed0e8fc8354
  Running setup.py bdist_wheel for logbook: started
  Running setup.py bdist_wheel for logbook: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/3a/50/0d/b67da0bb2a56061970cdf37a5e95fb07d9106200f33044616e
Successfully built zope.interface twisted pymodbus3 pendulum msgpack-python toml python-etcd logbook
Installing collected packages: zope.interface, constantly, incremental, attrs, six, Automat, idna, hyperlink, PyHamcrest, twisted, pyserial, pymodbus3, python-dateutil, pytzdata, pendulum, redis, pytz, chardet, urllib3, certifi, requests, influxdb, msgpack-python, toml, dnspython, python-etcd, python-mimeparse, falcon, waitress, greenlet, gevent, logbook
Successfully installed Automat-0.7.0 PyHamcrest-1.9.0 attrs-18.1.0 certifi-2018.4.16 chardet-3.0.4 constantly-15.1.0 dnspython-1.15.0 falcon-1.4.1 gevent-1.3.5 greenlet-0.4.14 hyperlink-18.0.0 idna-2.7 incremental-17.5.0 influxdb-5.2.0 logbook-1.4.0 msgpack-python-0.5.6 pendulum-2.0.2 pymodbus3-1.0.0 pyserial-3.4 python-dateutil-2.7.3 python-etcd-0.4.5 python-mimeparse-1.6.0 pytz-2018.5 pytzdata-2018.5 redis-2.10.6 requests-2.19.1 six-1.11.0 toml-0.9.4 twisted-18.7.0 urllib3-1.23 waitress-1.1.0 zope.interface-4.5.0
Removing intermediate container 3e97bb30b380
 ---> db0d53dad558
Successfully built db0d53dad558
Successfully tagged python_test:latest

If you have further questions you should ask the Docker Community Forums, the Docker Community Slack, or Stack Overflow. As these repositories are for issues with the image and not necessarily for questions of usability

And this seems relevant for your alpine build problem https://github.com/docker-library/python/issues/312#issuecomment-405326705

thanks for your help,i`ll try it.
thanks again.

@wglambert #312 (comment)
the way of intall gcc,is very usefully thanks.

RUN apk add --no-cache --virtual .build-deps gcc musl-dev
RUN pip install cython
RUN apk del .build-deps gcc musl-dev

I also needed python3-dev to install the psycopg2 package

@ziserendexin I got a problem :(

Step 4/9 : RUN apk add --no-cache --virtual .build-deps gcc musl-dev
 ---> Running in 62db2ecfbaca
/bin/sh: 1: apk: not found
The command '/bin/sh -c apk add --no-cache --virtual .build-deps gcc musl-dev' returned a non-zero code: 127

@wglambert #312 (comment)
the way of intall gcc,is very usefully thanks.

RUN apk add --no-cache --virtual .build-deps gcc musl-dev
RUN pip install cython
RUN apk del .build-deps gcc musl-dev

@ziserendexin I got a problem :(

Step 4/9 : RUN apk add --no-cache --virtual .build-deps gcc musl-dev
 ---> Running in 62db2ecfbaca
/bin/sh: 1: apk: not found
The command '/bin/sh -c apk add --no-cache --virtual .build-deps gcc musl-dev' returned a non-zero code: 127

@nvlong198 what's your base image? The above example is for alpine-based image.

@ziserendexin I got a problem :(

Step 4/9 : RUN apk add --no-cache --virtual .build-deps gcc musl-dev
 ---> Running in 62db2ecfbaca
/bin/sh: 1: apk: not found
The command '/bin/sh -c apk add --no-cache --virtual .build-deps gcc musl-dev' returned a non-zero code: 127

@wglambert #312 (comment)
the way of intall gcc,is very usefully thanks.

RUN apk add --no-cache --virtual .build-deps gcc musl-dev
RUN pip install cython
RUN apk del .build-deps gcc musl-dev

apk is alpine's Package manager. Maybe you should choose the package management command based on your base image.

This is wrong!

    RUN apk add --no-cache --virtual .build-deps gcc musl-dev
    RUN pip install cython
    RUN apk del .build-deps gcc musl-dev

this is ok

    RUN apk add --no-cache --virtual .build-deps gcc musl-dev \
     && pip install cython \
     && apk del .build-deps gcc musl-dev

Reason

If you don't remove the packages in the same step, the packages will end up in a docker layer and your images will not get smaller as the third step implies.

Was this page helpful?
0 / 5 - 0 ratings