Core dumped when trying to load file
jvadair opened this issue · 7 comments
To reproduce:
from just_playback import Playback
playback = Playback()
playback.load_file('sample.mp3')
playback.play()
This is taken directly from the example!
Command output
Illegal instruction (core dumped)
System specifications (uname output)
Linux spearmint 5.4.0-125-generic #141-Ubuntu SMP Wed Aug 10 13:42:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Hi @jvadair,
Try installing with pip install --no-binary just_playback just_playback
There seems to be a problem with the manylinux wheels probably due to some optimization flags use to build the C extension.
I'm currently investigating this. Any suggestions would be very welcome.
That solution indeed works. Thanks for your help.
I just installed Linux Mint 21 (Kernel 5.15.0-48-generic, Python 3.10.6) and found the following error when trying to use the suggested "no-binary" workaround:
$ pip install --no-binary just_playback just_playback
Defaulting to user installation because normal site-packages is not writeable
Collecting just_playback
Downloading just_playback-0.1.7.tar.gz (504 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 504.8/504.8 KB 2.8 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [38 lines of output]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
return self._get_build_requires(
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 143, in _get_build_requires
self.run_setup()
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 7, in <module>
setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 109, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 459, in __init__
_Distribution.__init__(
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 293, in __init__
self.finalize_options()
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 837, in finalize_options
ep(self)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 858, in _finalize_setup_keywords
ep.load()(self, ep.name, value)
File "/tmp/pip-build-env-q6op9ens/overlay/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 219, in cffi_modules
add_cffi_module(dist, cffi_module)
File "/tmp/pip-build-env-q6op9ens/overlay/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
execfile(build_file_name, mod_vars)
File "/tmp/pip-build-env-q6op9ens/overlay/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 25, in execfile
exec(code, glob, glob)
File "build_ffi_module.py", line 6, in <module>
ffibuilder = FFI()
File "/tmp/pip-build-env-q6op9ens/overlay/local/lib/python3.10/dist-packages/cffi/api.py", line 54, in __init__
raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r. The two versions should be equal; check your installation." % (
Exception: Version mismatch: this is the 'cffi' package version 1.15.1, located in '/tmp/pip-build-env-q6op9ens/overlay/local/lib/python3.10/dist-packages/cffi/api.py'. When we import the top-level '_cffi_backend' extension module, we get version 1.15.0, located in '/usr/lib/python3/dist-packages/_cffi_backend.cpython-310-x86_64-linux-gnu.so'. The two versions should be equal; check your installation.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Hi @Obliman,
Does pip3 install --upgrade cffi==1.5.0
fix the problem?
Hi @Obliman,
Does
pip3 install --upgrade cffi==1.5.0
fix the problem?
Thanks for the response.
After trying that I received an error due to "libffi" not being found.
I attempted to install libffi using sudo apt-get install -y libffi-dev
, then ran the cffi install again, but this leads to a pile of warnings and some errors. I guess this is a cffi issue, or related to the compiler, so I'll do some digging.
Defaulting to user installation because normal site-packages is not writeable
Collecting cffi==1.5.0
Using cached cffi-1.5.0.tar.gz (385 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pycparser in ./.local/lib/python3.10/site-packages (from cffi==1.5.0) (2.21)
Building wheels for collected packages: cffi
Building wheel for cffi (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [253 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/cffi
copying cffi/gc_weakref.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.10/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.10/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.10/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.10/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/c
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/python3.10 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.10/c/_cffi_backend.o
<various depreciation warnings>
c/_cffi_backend.c: In function ‘ctypedescr_dealloc’:
c/_cffi_backend.c:352:23: error: lvalue required as left operand of assignment
352 | Py_REFCNT(ct) = 43;
| ^
c/_cffi_backend.c:355:23: error: lvalue required as left operand of assignment
355 | Py_REFCNT(ct) = 0;
| ^
c/call_python.c: In function ‘_update_cache_to_call_python’:
c/call_python.c:132:39: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’}
132 | new1 = PyThreadState_GET()->interp->modules;
| ^~
c/call_python.c: In function ‘cffi_call_python’:
c/call_python.c:204:63: error: invalid use of incomplete typedef ‘PyInterpreterState’ {aka ‘struct _is’}
204 | if (externpy->reserved1 != PyThreadState_GET()->interp->modules) {
| ^~
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cffi
Running setup.py clean for cffi
Failed to build cffi
Okay, per the cffi forum this is related to how Ubuntu handles Python packaging and the current workarounds are to either use a virtualenv or supposedly find a version of pynacl to install that works.
I found that pip install PyNaCl
allowed me to install cffi 1.15.0, but I still encountered the original version mismatch error.
The solution:
Setting up a virtual environment using conda worked with the --no-binary
method.
I just want to point out that I encountered this same problem and the issue was the use of AVX-512 instructions. pretty much all AMD cpus (excluding some that came out this year) do not support this instruction set. if you're building the c component with gcc, -mno-avx512f
should fix this.