2

Problem: pip3 install apex fails because of failure to build cryptacular, errors as below.

cryptacular was successfully installed (before attempts of installing apex) using this one-liner: pip3 install -e hg+https://bitbucket.org/dholth/cryptacular@cb96fb3#egg=cryptacular Somehow it would not install with plain pip/pip3 install cryptacular, so the only way I found to successfully install this package is following these instructions, equivalent to these instructions.

However once I run pip3 install apex I receive the exact same error again.

It doesn't seem to be pip/pip3 issue - I've tried both with the same result.

Any ideas on what I am doing wrong?

Collecting apex
Collecting requests (from apex)
  Using cached https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl
----------------------- loads of "collecting" messages -------------------------
Collecting PasteDeploy>=2.0 (from plaster-pastedeploy->pyramid>1.1.2->apex)
  Using cached https://files.pythonhosted.org/packages/67/0c/faa9971b2e5e048b3b30008d04c72e4d5f63b42f48937c169acce2c5e70a/PasteDeploy-2.0.1-py2.py3-none-any.whl
Building wheels for collected packages: cryptacular
  Running setup.py bdist_wheel for cryptacular ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d8_sob/cryptacular/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/tmp7vBhDEpip-wheel- --python-tag cp27:
  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/cryptacular
  copying cryptacular/__init__.py -> build/lib.linux-x86_64-2.7/cryptacular
  creating build/lib.linux-x86_64-2.7/cryptacular/bcrypt
  copying cryptacular/bcrypt/__init__.py -> build/lib.linux-x86_64-2.7/cryptacular/bcrypt
  copying cryptacular/bcrypt/test_bcrypt.py -> build/lib.linux-x86_64-2.7/cryptacular/bcrypt
  creating build/lib.linux-x86_64-2.7/cryptacular/core
  copying cryptacular/core/test_core.py -> build/lib.linux-x86_64-2.7/cryptacular/core
  ...
  creating build/temp.linux-x86_64-2.7/cryptacular/bcrypt
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_blowfish.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_blowfish.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_gensalt.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_gensalt.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/wrapper.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/wrapper.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c cryptacular/bcrypt/_bcrypt.c -o build/temp.linux-x86_64-2.7/cryptacular/bcrypt/_bcrypt.o
  In file included from /usr/include/python2.7/Python.h:47:0,
                   from cryptacular/bcrypt/_bcrypt.c:26:
  crypt_blowfish-1.2/crypt.h:17:10: fatal error: gnu-crypt.h: No such file or directory
   #include <gnu-crypt.h>
            ^~~~~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cryptacular
  Running setup.py clean for cryptacular
Failed to build cryptacular
Installing collected packages: urllib3, certifi, chardet, idna, requests, wtforms, wtforms-recaptcha, setuptools, zope.interface, repoze.lru, PasteDeploy, plaster, plaster-pastedeploy, webob, venusian, zope.deprecation, translationstring, hupper, pyramid, oauthlib, requests-oauthlib, python-openid, anykeystore, velruse, transaction, repoze.sendmail, pyramid-mailer, SQLAlchemy, zope.sqlalchemy, pbkdf2, cryptacular, apex
  Running setup.py install for cryptacular ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d8_sob/cryptacular/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-Br1FfW-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    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/cryptacular
    copying cryptacular/__init__.py -> build/lib.linux-x86_64-2.7/cryptacular
    creating build/lib.linux-x86_64-2.7/cryptacular/bcrypt
    copying cryptacular/bcrypt/__init__.py -> build/lib.linux-x86_64-2.7/cryptacular/bcrypt
    ...
    creating build/temp.linux-x86_64-2.7/cryptacular/bcrypt
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_blowfish.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_blowfish.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_gensalt.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_gensalt.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/wrapper.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/wrapper.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c cryptacular/bcrypt/_bcrypt.c -o build/temp.linux-x86_64-2.7/cryptacular/bcrypt/_bcrypt.o
    In file included from /usr/include/python2.7/Python.h:47:0,
                     from cryptacular/bcrypt/_bcrypt.c:26:
    crypt_blowfish-1.2/crypt.h:17:10: fatal error: gnu-crypt.h: No such file or directory
     #include <gnu-crypt.h>
              ^~~~~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-d8_sob/cryptacular/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-Br1FfW-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-d8_sob/cryptacular/

UPDATE: Once I force gnu-crypt.h into required place: cd /usr/include && sudo mv crypt.h gnu-crypt.h I get a new but similar error:

  ...
  creating build/temp.linux-x86_64-2.7/cryptacular/bcrypt
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_blowfish.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_blowfish.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_gensalt.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_gensalt.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/wrapper.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/wrapper.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c cryptacular/bcrypt/_bcrypt.c -o build/temp.linux-x86_64-2.7/cryptacular/bcrypt/_bcrypt.o
  In file included from cryptacular/bcrypt/_bcrypt.c:27:0:
  crypt_blowfish-1.2/ow-crypt.h:27:14: error: conflicting types for ‘crypt_r’
   extern char *crypt_r(__const char *key, __const char *setting, void *data);
                ^~~~~~~
  In file included from crypt_blowfish-1.2/crypt.h:17:0,
                   from /usr/include/python2.7/Python.h:47,
                   from cryptacular/bcrypt/_bcrypt.c:26:
  /usr/include/gnu-crypt.h:60:14: note: previous declaration of ‘crypt_r’ was here
   extern char *crypt_r (const char *__key, const char *__salt,
                ^~~~~~~
  cryptacular/bcrypt/_bcrypt.c: In function ‘init_bcrypt’:
  cryptacular/bcrypt/_bcrypt.c:129:19: warning: unused variable ‘module’ [-Wunused-variable]
           PyObject *module = Py_InitModule("_bcrypt", _bcrypt_methods);
                     ^~~~~~
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cryptacular
  Running setup.py clean for cryptacular
Failed to build cryptacular
Installing collected packages: urllib3, certifi, chardet, idna, requests, wtforms, wtforms-recaptcha, setuptools, zope.interface, repoze.lru, PasteDeploy, plaster, plaster-pastedeploy, webob, venusian, zope.deprecation, translationstring, hupper, pyramid, oauthlib, requests-oauthlib, python-openid, anykeystore, velruse, transaction, repoze.sendmail, pyramid-mailer, SQLAlchemy, zope.sqlalchemy, pbkdf2, cryptacular, apex
  Running setup.py install for cryptacular ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqj6l9/cryptacular/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-CRC3Cz-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    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/cryptacular
    ...

    writing manifest file 'cryptacular.egg-info/SOURCES.txt'
    copying cryptacular/bcrypt/_bcrypt.c -> build/lib.linux-x86_64-2.7/cryptacular/bcrypt
    running build_ext
    building 'cryptacular.bcrypt._bcrypt' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/crypt_blowfish-1.2
    creating build/temp.linux-x86_64-2.7/cryptacular
    creating build/temp.linux-x86_64-2.7/cryptacular/bcrypt
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_blowfish.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_blowfish.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/crypt_gensalt.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/crypt_gensalt.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c crypt_blowfish-1.2/wrapper.c -o build/temp.linux-x86_64-2.7/crypt_blowfish-1.2/wrapper.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-3hk45v/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DNO_BF_ASM -Icrypt_blowfish-1.2/ -I/usr/include/python2.7 -c cryptacular/bcrypt/_bcrypt.c -o build/temp.linux-x86_64-2.7/cryptacular/bcrypt/_bcrypt.o
    In file included from cryptacular/bcrypt/_bcrypt.c:27:0:
    crypt_blowfish-1.2/ow-crypt.h:27:14: error: conflicting types for ‘crypt_r’
     extern char *crypt_r(__const char *key, __const char *setting, void *data);
                  ^~~~~~~
    In file included from crypt_blowfish-1.2/crypt.h:17:0,
                     from /usr/include/python2.7/Python.h:47,
                     from cryptacular/bcrypt/_bcrypt.c:26:
    /usr/include/gnu-crypt.h:60:14: note: previous declaration of ‘crypt_r’ was here
     extern char *crypt_r (const char *__key, const char *__salt,
                  ^~~~~~~
    cryptacular/bcrypt/_bcrypt.c: In function ‘init_bcrypt’:
    cryptacular/bcrypt/_bcrypt.c:129:19: warning: unused variable ‘module’ [-Wunused-variable]
             PyObject *module = Py_InitModule("_bcrypt", _bcrypt_methods);
                       ^~~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqj6l9/cryptacular/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-CRC3Cz-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-pqj6l9/cryptacular/
Massyanya
  • 2,844
  • 8
  • 28
  • 37
  • Possible duplicate of [setup script exited with error: command 'x86\_64-linux-gnu-gcc' failed with exit status 1](https://stackoverflow.com/questions/26053982/setup-script-exited-with-error-command-x86-64-linux-gnu-gcc-failed-with-exit) – Siddharth Das May 14 '19 at 09:44
  • 1
    Not likely. Just because it's a superficially similar error message doesn't mean it's a duplicate. – Iguananaut May 14 '19 at 10:33
  • 1
    Looks like this: https://bitbucket.org/dholth/cryptacular/issues/11/not-installing-on-ubuntu-1804 – Iguananaut May 14 '19 at 10:35
  • [Last pre-release is 0.9.10dev](https://pypi.org/project/apex/#history), released in 2013. Author's email is bogus. [The author](https://pypi.org/user/cd34/) released a few other packages, all abandoned in 2013. Do you really want to use the package? I'm not sure it supports Python 3 anyway. – phd May 14 '19 at 12:12
  • It's not my choice - official implementation of pix2pixHD uses it in train.py https://github.com/NVIDIA/pix2pixHD I am trying to use this code, that's why I need this package. – Massyanya May 14 '19 at 12:24
  • I had a look at the "README" file for pix2pixHD and the "apex" package it's using is another package from NVIDIA that has nothing to do with the "apex" that's on PyPI. Nothing whatsoever :( https://github.com/NVIDIA/pix2pixHD/blob/master/README.md#training-with-automatic-mixed-precision-amp-for-faster-speed – Iguananaut May 14 '19 at 12:47
  • I also saw an issue about this on NVIDIA apex: https://github.com/NVIDIA/apex/issues/209 – Iguananaut May 14 '19 at 13:04

1 Answers1

3

Uninstall the previous versions of apex. Then do these steps:

git clone https://www.github.com/nvidia/apex
cd apex
python setup.py install

worked like charm for me

Hasan Iqbal
  • 173
  • 16