First of all I use Ubuntu 17.10 and I downloaded previous version of python - python 3.4.0 because this older version is required in my project. I installed both memcached
and libmemcached-dev
and I can install without issues pylibmc
in virtual env based on python 3.6.3.
However during installing pylibmc
in enviroment based on Python 3.4.0
I get erros:
Collecting pylibmc==1.5.1 (from -r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/23/f4/3904b7171e61a83eafee0ed3b1b8efe4d3c6ddc05f7ebdff1831cf0e15f1/pylibmc-1.5.1.tar.gz
Building wheels for collected packages: pylibmc
Running setup.py bdist_wheel for pylibmc ... error
Complete output from command /home/przemek/usosApi34/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-859hcscx/pylibmc/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-_u6qlw_7 --python-tag cp34:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/__main__.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/__init__.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/client.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/consts.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/test.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/pools.py -> build/lib.linux-x86_64-3.4/pylibmc
running build_ext
building '_pylibmc' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/src
gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/home/przemek/opt/python-3.4.0/include/python3.4m -c src/_pylibmcmodule.c -o build/temp.linux-x86_64-3.4/src/_pylibmcmodule.o -fno-strict-aliasing -std=c99
src/_pylibmcmodule.c: In function ‘PylibMC_Client_init’:
src/_pylibmcmodule.c:209:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
int native_serialization, native_deserialization;
^~~
src/_pylibmcmodule.c: In function ‘_PylibMC_deserialize_native’:
src/_pylibmcmodule.c:642:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
PyObject *retval = NULL;
^~~~~~~~
src/_pylibmcmodule.c: In function ‘PylibMC_Client_gets’:
src/_pylibmcmodule.c:785:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
int miss = 0;
^~~
src/_pylibmcmodule.c: In function ‘_PylibMC_SerializeValue’:
src/_pylibmcmodule.c:1168:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
int success;
^~~
src/_pylibmcmodule.c: In function ‘_PylibMC_serialize_native’:
src/_pylibmcmodule.c:1247:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
const char *value_str = (value_obj == Py_True) ? "1" : "0";
^~~~~
src/_pylibmcmodule.c:1252:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
PyObject *tmp = PyObject_Str(value_obj);
^~~~~~~~
src/_pylibmcmodule.c: In function ‘PylibMC_Client_get_multi’:
src/_pylibmcmodule.c:1793:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
Py_ssize_t key_idx = 0;
^~~~~~~~~~
cc1: some warnings being treated as errors
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pylibmc
Running setup.py clean for pylibmc
Failed to build pylibmc
Installing collected packages: pylibmc
Running setup.py install for pylibmc ... error
Complete output from command /home/przemek/usosApi34/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-859hcscx/pylibmc/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-1r6f9jsj/install-record.txt --single-version-externally-managed --compile --install-headers /home/przemek/usosApi34/include/site/python3.4/pylibmc:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/__main__.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/__init__.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/client.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/consts.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/test.py -> build/lib.linux-x86_64-3.4/pylibmc
copying src/pylibmc/pools.py -> build/lib.linux-x86_64-3.4/pylibmc
running build_ext
building '_pylibmc' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/src
gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/home/przemek/opt/python-3.4.0/include/python3.4m -c src/_pylibmcmodule.c -o build/temp.linux-x86_64-3.4/src/_pylibmcmodule.o -fno-strict-aliasing -std=c99
src/_pylibmcmodule.c: In function ‘PylibMC_Client_init’:
src/_pylibmcmodule.c:209:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
int native_serialization, native_deserialization;
^~~
src/_pylibmcmodule.c: In function ‘_PylibMC_deserialize_native’:
src/_pylibmcmodule.c:642:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
PyObject *retval = NULL;
^~~~~~~~
src/_pylibmcmodule.c: In function ‘PylibMC_Client_gets’:
src/_pylibmcmodule.c:785:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
int miss = 0;
^~~
src/_pylibmcmodule.c: In function ‘_PylibMC_SerializeValue’:
src/_pylibmcmodule.c:1168:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
int success;
^~~
src/_pylibmcmodule.c: In function ‘_PylibMC_serialize_native’:
src/_pylibmcmodule.c:1247:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
const char *value_str = (value_obj == Py_True) ? "1" : "0";
^~~~~
src/_pylibmcmodule.c:1252:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
PyObject *tmp = PyObject_Str(value_obj);
^~~~~~~~
src/_pylibmcmodule.c: In function ‘PylibMC_Client_get_multi’:
src/_pylibmcmodule.c:1793:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
Py_ssize_t key_idx = 0;
^~~~~~~~~~
cc1: some warnings being treated as errors
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/przemek/usosApi34/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-859hcscx/pylibmc/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-1r6f9jsj/install-record.txt --single-version-externally-managed --compile --install-headers /home/przemek/usosApi34/include/site/python3.4/pylibmc" failed with error code 1 in /tmp/pip-install-859hcscx/pylibmc/
Do you know what might be the issue?
This is related to a bug in Python 3.4 that accidentally sets the CFLAG
to contain -Werror=declaration-after-statement
for all build steps. The errors you are seeing are a result of this flag being set. The solution is to manually unset it during pip install
CFLAGS=-Wno-error=declaration-after-statement pip install pylibmc==1.5.1