python-libmagic icon indicating copy to clipboard operation
python-libmagic copied to clipboard

Installation fails on Garuda/Arch linux

Open dscottboggs opened this issue 4 years ago • 2 comments

running pip install python-libmagic gives this stderr output

Defaulting to user installation because normal site-packages is not writeable
Collecting python-libmagic
  Using cached python-libmagic-0.4.0.tar.gz (3.6 kB)
Collecting cffi==1.7.0
  Using cached cffi-1.7.0.tar.gz (400 kB)
Requirement already satisfied: pycparser in /usr/lib/python3.9/site-packages (from cffi==1.7.0->python-libmagic) (2.20)
Using legacy 'setup.py install' for python-libmagic, since package 'wheel' is not installed.
Using legacy 'setup.py install' for cffi, since package 'wheel' is not installed.
Installing collected packages: cffi, python-libmagic
    Running setup.py install for cffi: started
    Running setup.py install for cffi: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4pw0ph7n/cffi_51878f6e4ed640de9d987187e8b01e45/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4pw0ph7n/cffi_51878f6e4ed640de9d987187e8b01e45/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-4zxi78s9/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/scott/.local/include/python3.9/cffi
         cwd: /tmp/pip-install-4pw0ph7n/cffi_51878f6e4ed640de9d987187e8b01e45/
    Complete output (254 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/cffi
    copying cffi/recompiler.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/verifier.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/__init__.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/lock.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/api.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/cparser.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/commontypes.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/model.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.9/cffi
    copying cffi/_embedding.h -> build/lib.linux-x86_64-3.9/cffi
    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/c
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -DUSE__THREAD -I/usr/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.9/c/_cffi_backend.o
    In file included from c/_cffi_backend.c:274:
    c/minibuffer.h: In function ‘mb_ass_slice’:
    c/minibuffer.h:66:5: warning: ‘PyObject_AsReadBuffer’ is deprecated [-Wdeprecated-declarations]
       66 |     if (PyObject_AsReadBuffer(other, &buffer, &buffer_len) < 0)
          |     ^~
    In file included from /usr/include/python3.9/Python.h:160,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/abstract.h:343:17: note: declared here
      343 | PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
          |                 ^~~~~~~~~~~~~~~~~~~~~
    In file included from c/_cffi_backend.c:277:
    c/file_emulator.h: In function ‘PyFile_AsFile’:
    c/file_emulator.h:54:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       54 |         mode = PyText_AsUTF8(ob_mode);
          |              ^
    In file included from c/_cffi_backend.c:281:
    c/wchar_helper.h: In function ‘_my_PyUnicode_AsSingleWideChar’:
    c/wchar_helper.h:83:5: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
       83 |     Py_UNICODE *u = PyUnicode_AS_UNICODE(unicode);
          |     ^~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
      580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
          |                                             ^~~~~~~~~~~~~~~~~~~
    In file included from c/_cffi_backend.c:281:
    c/wchar_helper.h:84:5: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       84 |     if (PyUnicode_GET_SIZE(unicode) == 1) {
          |     ^~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
      446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from c/_cffi_backend.c:281:
    c/wchar_helper.h:84:5: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
       84 |     if (PyUnicode_GET_SIZE(unicode) == 1) {
          |     ^~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
      580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
          |                                             ^~~~~~~~~~~~~~~~~~~
    In file included from c/_cffi_backend.c:281:
    c/wchar_helper.h:84:5: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       84 |     if (PyUnicode_GET_SIZE(unicode) == 1) {
          |     ^~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
      446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from c/_cffi_backend.c:281:
    c/wchar_helper.h: In function ‘_my_PyUnicode_SizeAsWideChar’:
    c/wchar_helper.h:99:5: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       99 |     Py_ssize_t length = PyUnicode_GET_SIZE(unicode);
          |     ^~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
      446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from c/_cffi_backend.c:281:
    c/wchar_helper.h:99:5: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
       99 |     Py_ssize_t length = PyUnicode_GET_SIZE(unicode);
          |     ^~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
      580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
          |                                             ^~~~~~~~~~~~~~~~~~~
    In file included from c/_cffi_backend.c:281:
    c/wchar_helper.h:99:5: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       99 |     Py_ssize_t length = PyUnicode_GET_SIZE(unicode);
          |     ^~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
      446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from c/_cffi_backend.c:281:
    c/wchar_helper.h: In function ‘_my_PyUnicode_AsWideChar’:
    c/wchar_helper.h:118:5: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
      118 |     Py_UNICODE *u = PyUnicode_AS_UNICODE(unicode);
          |     ^~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
      580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
          |                                             ^~~~~~~~~~~~~~~~~~~
    c/_cffi_backend.c: In function ‘cast_to_integer_or_char’:
    c/_cffi_backend.c:3331:26: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
     3331 |                          PyUnicode_GET_SIZE(ob), ct->ct_name);
          |                          ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
      446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
    c/_cffi_backend.c:3331:26: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
     3331 |                          PyUnicode_GET_SIZE(ob), ct->ct_name);
          |                          ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
      580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
          |                                             ^~~~~~~~~~~~~~~~~~~
    c/_cffi_backend.c:3331:26: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
     3331 |                          PyUnicode_GET_SIZE(ob), ct->ct_name);
          |                          ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
      446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
    c/_cffi_backend.c: In function ‘b_complete_struct_or_union’:
    c/_cffi_backend.c:4251:17: warning: ‘PyUnicode_GetSize’ is deprecated [-Wdeprecated-declarations]
     4251 |                 do_align = PyText_GetSize(fname) > 0;
          |                 ^~~~~~~~
    In file included from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/unicodeobject.h:177:43: note: declared here
      177 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
          |                                           ^~~~~~~~~~~~~~~~~
    c/_cffi_backend.c:4283:13: warning: ‘PyUnicode_GetSize’ is deprecated [-Wdeprecated-declarations]
     4283 |             if (PyText_GetSize(fname) == 0 &&
          |             ^~
    In file included from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/unicodeobject.h:177:43: note: declared here
      177 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
          |                                           ^~~~~~~~~~~~~~~~~
    c/_cffi_backend.c:4353:17: warning: ‘PyUnicode_GetSize’ is deprecated [-Wdeprecated-declarations]
     4353 |                 if (PyText_GetSize(fname) > 0) {
          |                 ^~
    In file included from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/unicodeobject.h:177:43: note: declared here
      177 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
          |                                           ^~~~~~~~~~~~~~~~~
    c/_cffi_backend.c: In function ‘prepare_callback_info_tuple’:
    c/_cffi_backend.c:5214:5: warning: ‘PyEval_InitThreads’ is deprecated [-Wdeprecated-declarations]
     5214 |     PyEval_InitThreads();
          |     ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.9/Python.h:154,
                     from c/_cffi_backend.c:2:
    /usr/include/python3.9/ceval.h:130:37: note: declared here
      130 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
          |                                     ^~~~~~~~~~~~~~~~~~
    c/_cffi_backend.c: In function ‘b_callback’:
    c/_cffi_backend.c:5255:5: warning: ‘ffi_prep_closure’ is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
     5255 |     if (ffi_prep_closure(closure, &cif_descr->cif,
          |     ^~
    In file included from c/_cffi_backend.c:15:
    /usr/include/ffi.h:347:1: note: declared here
      347 | ffi_prep_closure (ffi_closure*,
          | ^~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.9/unicodeobject.h:1026,
                     from /usr/include/python3.9/Python.h:106,
                     from c/_cffi_backend.c:2:
    c/ffi_obj.c: In function ‘_ffi_type’:
    /usr/include/python3.9/cpython/unicodeobject.h:767:29: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      767 | #define _PyUnicode_AsString PyUnicode_AsUTF8
          |                             ^~~~~~~~~~~~~~~~
    c/_cffi_backend.c:72:25: note: in expansion of macro ‘_PyUnicode_AsString’
       72 | # define PyText_AS_UTF8 _PyUnicode_AsString
          |                         ^~~~~~~~~~~~~~~~~~~
    c/ffi_obj.c:191:32: note: in expansion of macro ‘PyText_AS_UTF8’
      191 |             char *input_text = PyText_AS_UTF8(arg);
          |                                ^~~~~~~~~~~~~~
    c/lib_obj.c: In function ‘lib_build_cpython_func’:
    /usr/include/python3.9/cpython/unicodeobject.h:767:29: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      767 | #define _PyUnicode_AsString PyUnicode_AsUTF8
          |                             ^~~~~~~~~~~~~~~~
    c/_cffi_backend.c:72:25: note: in expansion of macro ‘_PyUnicode_AsString’
       72 | # define PyText_AS_UTF8 _PyUnicode_AsString
          |                         ^~~~~~~~~~~~~~~~~~~
    c/lib_obj.c:129:21: note: in expansion of macro ‘PyText_AS_UTF8’
      129 |     char *libname = PyText_AS_UTF8(lib->l_libname);
          |                     ^~~~~~~~~~~~~~
    c/lib_obj.c: In function ‘lib_build_and_cache_attr’:
    /usr/include/python3.9/cpython/unicodeobject.h:767:29: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      767 | #define _PyUnicode_AsString PyUnicode_AsUTF8
          |                             ^~~~~~~~~~~~~~~~
    c/_cffi_backend.c:71:24: note: in expansion of macro ‘_PyUnicode_AsString’
       71 | # define PyText_AsUTF8 _PyUnicode_AsString   /* PyUnicode_AsUTF8 in Py3.3 */
          |                        ^~~~~~~~~~~~~~~~~~~
    c/lib_obj.c:208:15: note: in expansion of macro ‘PyText_AsUTF8’
      208 |     char *s = PyText_AsUTF8(name);
          |               ^~~~~~~~~~~~~
    In file included from c/cffi1_module.c:16,
                     from c/_cffi_backend.c:6636:
    c/lib_obj.c: In function ‘lib_getattr’:
    c/lib_obj.c:506:7: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      506 |     p = PyText_AsUTF8(name);
          |       ^
    In file included from c/cffi1_module.c:19,
                     from c/_cffi_backend.c:6636:
    c/call_python.c: In function ‘_get_interpstate_dict’:
    c/call_python.c:20:30: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’}
       20 |     builtins = tstate->interp->builtins;
          |                              ^~
    c/call_python.c: In function ‘_ffi_def_extern_decorator’:
    c/call_python.c:73:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       73 |         s = PyText_AsUTF8(name);
          |           ^
    c/call_python.c: In function ‘_update_cache_to_call_python’:
    c/call_python.c:160:39: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’}
      160 |     new1 = PyThreadState_GET()->interp->modules;
          |                                       ^~
    c/call_python.c: In function ‘cffi_call_python’:
    c/call_python.c:235:63: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’}
      235 |         if (externpy->reserved1 != PyThreadState_GET()->interp->modules) {
          |                                                               ^~
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4pw0ph7n/cffi_51878f6e4ed640de9d987187e8b01e45/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4pw0ph7n/cffi_51878f6e4ed640de9d987187e8b01e45/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-4zxi78s9/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/scott/.local/include/python3.9/cffi Check the logs for full command output.

It looks like something changed in the CFFI library? I don't know.

dscottboggs avatar Oct 26 '21 12:10 dscottboggs

I seem to be running into this issue. Was there a fix / workaround provided?

j4loop avatar Sep 17 '24 03:09 j4loop

It's been...quite some time obviously, but I think I remember just shelling out to the file command for what I was trying to do, unfortunately.

dscottboggs avatar Sep 19 '24 11:09 dscottboggs