Python: Regression installing bcrypt 2.0.0 on alpine 2.7.15

Created on 14 May 2018  路  5Comments  路  Source: docker-library/python

I am not able to install bcrypt==2.0.0 on alpine 2.7.15 image, but it works fine on 2.7.14.

2.7.15

$ cat Dockerfile
FROM python:2.7.15-alpine
RUN apk --no-cache add openssl-dev
RUN apk --no-cache add --virtual build-dependencies gcc g++ make libffi-dev
RUN pip install bcrypt==2.0.0

$ docker build .
Sending build context to Docker daemon  2.048kB
Step 1/4 : FROM python:2.7.15-alpine
 ---> 5fdd069daf25
Step 2/4 : RUN apk --no-cache add openssl-dev
 ---> Using cache
 ---> d284d0fb4e51
Step 3/4 : RUN apk --no-cache add --virtual build-dependencies gcc g++ make libffi-dev
 ---> Using cache
 ---> 09bdb4804165
Step 4/4 : RUN pip install bcrypt==2.0.0
 ---> Running in 7977a301ccd2
Collecting bcrypt==2.0.0
  Downloading https://files.pythonhosted.org/packages/11/7d/4c7980d04314466de42ea804db71995c9b3a2a47dc79a63c51f1be0cfd50/bcrypt-2.0.0.tar.gz
Collecting cffi>=1.1 (from bcrypt==2.0.0)
  Downloading https://files.pythonhosted.org/packages/e7/a7/4cd50e57cc6f436f1cc3a7e8fa700ff9b8b4d471620629074913e3735fb2/cffi-1.11.5.tar.gz (438kB)
Collecting six>=1.4.1 (from bcrypt==2.0.0)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting pycparser (from cffi>=1.1->bcrypt==2.0.0)
  Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245kB)
Building wheels for collected packages: bcrypt, cffi, pycparser
  Running setup.py bdist_wheel for bcrypt: started
  Running setup.py bdist_wheel for bcrypt: finished with status 'error'
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-Q8Mw8R/bcrypt/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-hi9wyU --python-tag cp27:

  Installed /tmp/pip-install-Q8Mw8R/bcrypt/.eggs/cffi-1.11.5-py2.7-linux-x86_64.egg
  Searching for pycparser
  Reading https://pypi.org/simple/pycparser/
  Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz#sha256=99a8ca03e29851d96616ad0404b4aad7d9ee16f25c9f9708a11faf2810f7b226
  Best match: pycparser 2.18
  Processing pycparser-2.18.tar.gz
  Writing /tmp/easy_install-GUDqYD/pycparser-2.18/setup.cfg
  Running pycparser-2.18/setup.py -q bdist_egg --dist-dir /tmp/easy_install-GUDqYD/pycparser-2.18/egg-dist-tmp-eqt58z
  warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
  warning: no previously-included files matching 'lextab.*' found under directory 'tests'
  warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
  warning: no previously-included files matching 'lextab.*' found under directory 'examples'
  zip_safe flag not set; analyzing archive contents...
  pycparser.ply.lex: module references __file__
  pycparser.ply.lex: module MAY be using inspect.getsourcefile
  pycparser.ply.yacc: module references __file__
  pycparser.ply.yacc: module MAY be using inspect.getsourcefile
  pycparser.ply.yacc: module MAY be using inspect.stack
  pycparser.ply.ygen: module references __file__
  creating /tmp/pip-install-Q8Mw8R/bcrypt/.eggs/pycparser-2.18-py2.7.egg
  Extracting pycparser-2.18-py2.7.egg to /tmp/pip-install-Q8Mw8R/bcrypt/.eggs

  Installed /tmp/pip-install-Q8Mw8R/bcrypt/.eggs/pycparser-2.18-py2.7.egg
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/bcrypt
  copying src/bcrypt/__init__.py -> build/lib.linux-x86_64-2.7/bcrypt
  copying src/bcrypt/__about__.py -> build/lib.linux-x86_64-2.7/bcrypt
  running build_ext
  generating cffi module 'build/temp.linux-x86_64-2.7/_bcrypt.c'
  creating build/temp.linux-x86_64-2.7
  building '_bcrypt' extension
  creating build/temp.linux-x86_64-2.7/build
  creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/src
  creating build/temp.linux-x86_64-2.7/src/crypt_blowfish-1.3
  gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/crypt_blowfish-1.3 -I/usr/local/include/python2.7 -c build/temp.linux-x86_64-2.7/_bcrypt.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_bcrypt.o
  In file included from /usr/local/include/python2.7/Python.h:47:0,
                   from build/temp.linux-x86_64-2.7/_bcrypt.c:28:
  src/crypt_blowfish-1.3/crypt.h:17:23: fatal error: gnu-crypt.h: No such file or directory
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for bcrypt
  Running setup.py clean for bcrypt
  Running setup.py bdist_wheel for cffi: started
  Running setup.py bdist_wheel for cffi: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/e6/9e/cd/9f0b900a715af094d5a08cc50230728c08ef745ffb195c67e8
  Running setup.py bdist_wheel for pycparser: started
  Running setup.py bdist_wheel for pycparser: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/c0/a1/27/5ba234bd77ea5a290cbf6d675259ec52293193467a12ef1f46
Successfully built cffi pycparser
Failed to build bcrypt
Installing collected packages: pycparser, cffi, six, bcrypt
  Running setup.py install for bcrypt: started
    Running setup.py install for bcrypt: finished with status 'error'
    Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-Q8Mw8R/bcrypt/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-vlAcOa/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/bcrypt
    copying src/bcrypt/__init__.py -> build/lib.linux-x86_64-2.7/bcrypt
    copying src/bcrypt/__about__.py -> build/lib.linux-x86_64-2.7/bcrypt
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-2.7/_bcrypt.c'
    creating build/temp.linux-x86_64-2.7
    building '_bcrypt' extension
    creating build/temp.linux-x86_64-2.7/build
    creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    creating build/temp.linux-x86_64-2.7/src/crypt_blowfish-1.3
    gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/crypt_blowfish-1.3 -I/usr/local/include/python2.7 -c build/temp.linux-x86_64-2.7/_bcrypt.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_bcrypt.o
    In file included from /usr/local/include/python2.7/Python.h:47:0,
                     from build/temp.linux-x86_64-2.7/_bcrypt.c:28:
    src/crypt_blowfish-1.3/crypt.h:17:23: fatal error: gnu-crypt.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1

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

2.7.14

$ docker build .
Sending build context to Docker daemon  2.048kB
Step 1/4 : FROM python:2.7.14-alpine
 ---> b7ebfc836cfe
Step 2/4 : RUN apk --no-cache add openssl-dev
 ---> Using cache
 ---> ce8d16f3ddd9
Step 3/4 : RUN apk --no-cache add --virtual build-dependencies gcc g++ make libffi-dev
 ---> Using cache
 ---> 44360e3afc0d
Step 4/4 : RUN pip install bcrypt==2.0.0
 ---> Running in 22a45386154e
Collecting bcrypt==2.0.0
  Downloading https://files.pythonhosted.org/packages/11/7d/4c7980d04314466de42ea804db71995c9b3a2a47dc79a63c51f1be0cfd50/bcrypt-2.0.0.tar.gz
Collecting cffi>=1.1 (from bcrypt==2.0.0)
  Downloading https://files.pythonhosted.org/packages/e7/a7/4cd50e57cc6f436f1cc3a7e8fa700ff9b8b4d471620629074913e3735fb2/cffi-1.11.5.tar.gz (438kB)
Collecting six>=1.4.1 (from bcrypt==2.0.0)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting pycparser (from cffi>=1.1->bcrypt==2.0.0)
  Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245kB)
Building wheels for collected packages: bcrypt, cffi, pycparser
  Running setup.py bdist_wheel for bcrypt: started
  Running setup.py bdist_wheel for bcrypt: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/fb/84/0c/e13ff6f9cae9380e236fad080cdff88f99f8a376966a6a2a9c
  Running setup.py bdist_wheel for cffi: started
  Running setup.py bdist_wheel for cffi: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/e6/9e/cd/9f0b900a715af094d5a08cc50230728c08ef745ffb195c67e8
  Running setup.py bdist_wheel for pycparser: started
  Running setup.py bdist_wheel for pycparser: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/c0/a1/27/5ba234bd77ea5a290cbf6d675259ec52293193467a12ef1f46
Successfully built bcrypt cffi pycparser
Installing collected packages: pycparser, cffi, six, bcrypt
Successfully installed bcrypt-2.0.0 cffi-1.11.5 pycparser-2.18 six-1.11.0
Removing intermediate container 22a45386154e
 ---> ab7dba354fcf
Successfully built ab7dba354fcf
question

Most helpful comment

I believe this is an issue with bcrypt, as I have encountered it independently of any images, simply running on Ubuntu

All 5 comments

As far as I can tell, gnu-crypt.h hasn't really _ever_ existed in Alpine: https://pkgs.alpinelinux.org/contents?file=gnu-crypt.h :confused:

(So I'm not sure how this could have worked on the older Python release.)

There doesn't seem to be an error with the image that we could fix so I'm going to close

have same problem...

I have the same issue with python:3.7.2-alpine

I believe this is an issue with bcrypt, as I have encountered it independently of any images, simply running on Ubuntu

Was this page helpful?
0 / 5 - 0 ratings