partridge icon indicating copy to clipboard operation
partridge copied to clipboard

cchardet doesn't work with python 3.10+

Open brockhaywood opened this issue 2 years ago • 1 comments

  • partridge version: *
  • Python version: 3.10.x
  • Operating System: *nix

Description

cChardet appears to be an abandoned project and is not compatible with python 3.10 (without compiling from source).

https://github.com/PyYoshi/cChardet/issues/77

As a result installing partridge via pip fails

What I Did

#18 96.96   Running setup.py install for cchardet: finished with status 'error'
#18 96.97   error: subprocess-exited-with-error
#18 96.97
#18 96.97   × Running setup.py install for cchardet did not run successfully.
#18 96.97   │ exit code: 1
#18 96.97   ╰─> [24 lines of output]
#18 96.97       running install
#18 96.97       running build
#18 96.97       running build_py
#18 96.97       creating build
#18 96.97       creating build/lib.linux-x86_64-3.10
#18 96.97       creating build/lib.linux-x86_64-3.10/cchardet
#18 96.97       copying src/cchardet/__init__.py -> build/lib.linux-x86_64-3.10/cchardet
#18 96.97       copying src/cchardet/version.py -> build/lib.linux-x86_64-3.10/cchardet
#18 96.97       running build_ext
#18 96.97       building 'cchardet._cchardet' extension
#18 96.97       creating build/temp.linux-x86_64-3.10
#18 96.97       creating build/temp.linux-x86_64-3.10/src
#18 96.97       creating build/temp.linux-x86_64-3.10/src/cchardet
#18 96.97       creating build/temp.linux-x86_64-3.10/src/ext
#18 96.97       creating build/temp.linux-x86_64-3.10/src/ext/uchardet
#18 96.97       creating build/temp.linux-x86_64-3.10/src/ext/uchardet/src
#18 96.97       creating build/temp.linux-x86_64-3.10/src/ext/uchardet/src/LangModels
#18 96.97       gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Isrc/ext/uchardet/src -I/usr/local/include/python3.10 -c src/cchardet/_cchardet.cpp -o build/temp.linux-x86_64-3.10/src/cchardet/_cchardet.o
#18 96.97       src/cchardet/_cchardet.cpp: In function ‘int __Pyx_modinit_type_init_code()’:
#18 96.97       src/cchardet/_cchardet.cpp:2466:53: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’; did you mean ‘tp_dict’?
#18 96.97          __pyx_type_8cchardet_9_cchardet_UniversalDetector.tp_print = 0;
#18 96.97                                                            ^~~~~~~~
#18 96.97                                                            tp_dict
#18 96.97       error: command '/usr/bin/gcc' failed with exit code 1
#18 96.97       [end of output]
#18 96.97
#18 96.97   note: This error originates from a subprocess, and is likely not a problem with pip.
#18 96.97 error: legacy-install-failure
#18 96.97
#18 96.97 × Encountered error while trying to install package.
#18 96.97 ╰─> cchardet

It seems like switching back to chardet or optionally using chardet when on python 3.10+ would be potential alternatives.

brockhaywood avatar Aug 05 '22 16:08 brockhaywood

Some possible fixes:

  • https://github.com/remix/partridge/pull/75
  • https://github.com/remix/partridge/pull/76

brockhaywood avatar Aug 08 '22 18:08 brockhaywood

Any chance one of the maintainers could follow up on this?

brockhaywood avatar Nov 22 '22 17:11 brockhaywood