Python Forum
pip3 install functools failed - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: pip3 install functools failed (/thread-16587.html)



pip3 install functools failed - kintarowonders - Mar-06-2019

I am trying to install functools to experiment with code that uses it, but it fails to install.

Distro is Fedora 29 Workstation.

$ pip3 install functools
Collecting functools
  Using cached https://files.pythonhosted.org/packages/22/3c/33589bf30422a92cf8c77054f2cf940ef2acc8a2857e5664045ed75a1c6a/functools-0.5.tar.gz
Installing collected packages: functools
  Running setup.py install for functools ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-2sncjil5/functools/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-6a32khwe/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    copying functools.py -> build/lib.linux-x86_64-3.7
    running build_ext
    building '_functools' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.7m -c src/functools.c -o build/temp.linux-x86_64-3.7/src/functools.o
    src/functools.c: In function ‘init_functools’:
    src/functools.c:43:6: warning: implicit declaration of function ‘Py_InitModule3’; did you mean ‘Py_Initialize’? [-Wimplicit-function-declaration]
      m = Py_InitModule3("_functools", NULL, functools_doc);
          ^~~~~~~~~~~~~~
          Py_Initialize
    src/functools.c:43:4: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      m = Py_InitModule3("_functools", NULL, functools_doc);
        ^
    src/functools.c:45:3: warning: ‘return’ with no value, in function returning non-void
       return;
       ^~~~~~
    src/functools.c:38:1: note: declared here
     init_functools(void)
     ^~~~~~~~~~~~~~
    src/functools.c:49:2: warning: ‘return’ with no value, in function returning non-void
      return;
      ^~~~~~
    src/functools.c:38:1: note: declared here
     init_functools(void)
     ^~~~~~~~~~~~~~
    At top level:
    src/functools.c:28:19: warning: ‘rcsid’ defined but not used [-Wunused-const-variable=]
     static const char rcsid[] = "@(#)$Dima: pylib/functools/src/functools.c,v 1.3 2005/08/22 07:39:33 dima Exp $";
                       ^~~~~
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.7m -c src/compose.c -o build/temp.linux-x86_64-3.7/src/compose.o
    src/compose.c: In function ‘compose_dealloc’:
    src/compose.c:96:6: error: ‘struct compose’ has no member named ‘ob_type’; did you mean ‘ob_base’?
      co->ob_type->tp_free(co);
          ^~~~~~~
          ob_base
    src/compose.c: In function ‘compose_repr’:
    src/compose.c:137:6: warning: implicit declaration of function ‘PyString_FromFormat’; did you mean ‘PyBytes_FromFormat’? [-Wimplicit-function-declaration]
      s = PyString_FromFormat("<composition on %s at %p>",
          ^~~~~~~~~~~~~~~~~~~
          PyBytes_FromFormat
    src/compose.c:138:6: warning: implicit declaration of function ‘PyString_AsString’; did you mean ‘PyBytes_AsString’? [-Wimplicit-function-declaration]
          PyString_AsString(grepr), (void *)co);
          ^~~~~~~~~~~~~~~~~
          PyBytes_AsString
    src/compose.c:137:4: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      s = PyString_FromFormat("<composition on %s at %p>",
        ^
    src/compose.c: At top level:
    src/compose.c:143:36: warning: missing braces around initializer [-Wmissing-braces]
     static PyTypeObject compose_type = {
                                        ^
    src/compose.c:146:2: warning: initialization of ‘long int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
      "compose",   /* tp_name */
      ^~~~~~~~~
    src/compose.c:146:2: note: (near initialization for ‘compose_type.tp_basicsize’)
    src/compose.c:150:2: warning: initialization of ‘int (*)(PyObject *, FILE *, int)’ {aka ‘int (*)(struct _object *, struct _IO_FILE *, int)’} from incompatible pointer type ‘void (*)(PyObject *)’ {aka ‘void (*)(struct _object *)’} [-Wincompatible-pointer-types]
      (destructor)compose_dealloc, /* tp_dealloc */
      ^
    src/compose.c:150:2: note: (near initialization for ‘compose_type.tp_print’)
    src/compose.c:155:2: warning: initialization of ‘PyNumberMethods *’ {aka ‘struct <anonymous> *’} from incompatible pointer type ‘PyObject * (*)(PyObject *)’ {aka ‘struct _object * (*)(struct _object *)’} [-Wincompatible-pointer-types]
      (reprfunc)compose_repr,  /* tp_repr */
      ^
    src/compose.c:155:2: note: (near initialization for ‘compose_type.tp_as_number’)
    src/compose.c:160:2: warning: initialization of ‘PyObject * (*)(PyObject *)’ {aka ‘struct _object * (*)(struct _object *)’} from incompatible pointer type ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} [-Wincompatible-pointer-types]
      (ternaryfunc)compose_call, /* tp_call */
      ^
    src/compose.c:160:2: note: (near initialization for ‘compose_type.tp_str’)
    In file included from /usr/include/python3.7m/pytime.h:6,
                     from /usr/include/python3.7m/Python.h:77,
                     from src/compose.c:31:
    /usr/include/python3.7m/object.h:671:29: warning: initialization of ‘const char *’ from ‘long unsigned int’ makes pointer from integer without a cast [-Wint-conversion]
     #define Py_TPFLAGS_DEFAULT  ( \
                                 ^
    src/compose.c:165:2: note: in expansion of macro ‘Py_TPFLAGS_DEFAULT’
      Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
      ^~~~~~~~~~~~~~~~~~
    /usr/include/python3.7m/object.h:671:29: note: (near initialization for ‘compose_type.tp_doc’)
     #define Py_TPFLAGS_DEFAULT  ( \
                                 ^
    src/compose.c:165:2: note: in expansion of macro ‘Py_TPFLAGS_DEFAULT’
      Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
      ^~~~~~~~~~~~~~~~~~
    src/compose.c:167:2: warning: initialization of ‘int (*)(PyObject *, int (*)(PyObject *, void *), void *)’ {aka ‘int (*)(struct _object *, int (*)(struct _object *, void *), void *)’} from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]
      compose_doc,   /* tp_doc */
      ^~~~~~~~~~~
    src/compose.c:167:2: note: (near initialization for ‘compose_type.tp_traverse’)
    src/compose.c:168:2: warning: initialization of ‘int (*)(PyObject *)’ {aka ‘int (*)(struct _object *)’} from incompatible pointer type ‘int (*)(PyObject *, int (*)(PyObject *, void *), void *)’ {aka ‘int (*)(struct _object *, int (*)(struct _object *, void *), void *)’} [-Wincompatible-pointer-types]
      (traverseproc)compose_traverse, /* tp_traverse */
      ^
    src/compose.c:168:2: note: (near initialization for ‘compose_type.tp_clear’)
    src/compose.c:179:2: warning: initialization of ‘int (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘int (*)(struct _object *, struct _object *, struct _object *)’} from incompatible pointer type ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wincompatible-pointer-types]
      PyMethod_New,   /* tp_descr_get */
      ^~~~~~~~~~~~
    src/compose.c:179:2: note: (near initialization for ‘compose_type.tp_descr_set’)
    src/compose.c:184:2: warning: initialization of ‘void (*)(void *)’ from incompatible pointer type ‘PyObject * (*)(PyTypeObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _typeobject *, struct _object *, struct _object *)’} [-Wincompatible-pointer-types]
      compose_new,   /* tp_new */
      ^~~~~~~~~~~
    src/compose.c:184:2: note: (near initialization for ‘compose_type.tp_free’)
    src/compose.c:185:2: warning: initialization of ‘int (*)(PyObject *)’ {aka ‘int (*)(struct _object *)’} from incompatible pointer type ‘void (*)(void *)’ [-Wincompatible-pointer-types]
      PyObject_GC_Del,  /* tp_free */
      ^~~~~~~~~~~~~~~
    src/compose.c:185:2: note: (near initialization for ‘compose_type.tp_is_gc’)
    src/compose.c:143:36: warning: missing braces around initializer [-Wmissing-braces]
     static PyTypeObject compose_type = {
                                        ^
    src/compose.c:28:19: warning: ‘rcsid’ defined but not used [-Wunused-const-variable=]
     static const char rcsid[] = "@(#)$Dima: pylib/functools/src/compose.c,v 1.3 2005/08/22 07:39:33 dima Exp $";
                       ^~~~~
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-2sncjil5/functools/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-6a32khwe/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-2sncjil5/functools/

Looks like functools is already there, just tried 'import functools' from the shell and it looks like it worked. I'll leave this here in case anyone is as stupid as me.


RE: pip3 install functools failed - nilamo - Mar-07-2019

(Mar-06-2019, 05:47 AM)kintarowonders Wrote: Looks like functools is already there, just tried 'import functools' from the shell and it looks like it worked

Yep, functools is a builtin module as of 2.5. Glad you found it :)