cChardet
cChardet copied to clipboard
Can't install cChardet on my ARM64 machine
OS/Arch
('Linux', 'S905X', '5.9.8-meson64', '#trunk SMP PREEMPT Thu Nov 12 23:40:19 UTC 2020', 'aarch64', 'aarch64')
Python version
Python 3.8.8
cChardet version
2.1.7 and below version
What is the problem?
Can't install cchardet. Maybe it's because setup.py
Expected behavior
It can install normally
Actual behavior
Showing error
Collecting cchardet Using cached cchardet-2.1.7.tar.gz (653 kB) Building wheels for collected packages: cchardet Building wheel for cchardet (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hxlmfkru/cchardet_ec84530a651448e8b7d54bd420b69736/setup.py' "'"'; file='"'"'/tmp/pip-install-hxlmfkru/cchardet_ec84530a651448e8b7d54bd420b69736/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-gfswq87_ cwd: /tmp/pip-install-hxlmfkru/cchardet_ec84530a651448e8b7d54bd420b69736/ Complete output (24 lines): cythonize: ['src/cchardet/_cchardet.pyx'] running bdist_wheel running build running build_py creating build creating build/lib.linux-aarch64-3.8 creating build/lib.linux-aarch64-3.8/cchardet copying src/cchardet/version.py -> build/lib.linux-aarch64-3.8/cchardet copying src/cchardet/init.py -> build/lib.linux-aarch64-3.8/cchardet running build_ext building 'cchardet._cchardet' extension creating build/temp.linux-aarch64-3.8 creating build/temp.linux-aarch64-3.8/src creating build/temp.linux-aarch64-3.8/src/cchardet creating build/temp.linux-aarch64-3.8/src/ext creating build/temp.linux-aarch64-3.8/src/ext/uchardet creating build/temp.linux-aarch64-3.8/src/ext/uchardet/src creating build/temp.linux-aarch64-3.8/src/ext/uchardet/src/LangModels aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack -protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isrc/ext/uchardet/src -I/usr/include/python3.8 -c src/cchardet/_cchardet.cpp - o build/temp.linux-aarch64-3.8/src/cchardet/_cchardet.o src/cchardet/_cchardet.cpp:4:10: fatal error: Python.h: No such file or directory #include "Python.h" ^~~~~~~~~~ compilation terminated. error: command 'aarch64-linux-gnu-gcc' failed with exit status 1 ERROR: Failed building wheel for cchardet Running setup.py clean for cchardet Failed to build cchardet Installing collected packages: cchardet Running setup.py install for cchardet ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hxlmfkru/cchardet_ec84530a651448e8b7d54bd420b69736/setup.py'"'"'; file='"'"'/tmp/pip-install-hxlmfkru/cchardet_ec84530a651448e8b7d54bd420b69736/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-okdztqew/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/cchardet cwd: /tmp/pip-install-hxlmfkru/cchardet_ec84530a651448e8b7d54bd420b69736/ Complete output (24 lines): cythonize: ['src/cchardet/_cchardet.pyx'] running install running build running build_py creating build creating build/lib.linux-aarch64-3.8 creating build/lib.linux-aarch64-3.8/cchardet copying src/cchardet/version.py -> build/lib.linux-aarch64-3.8/cchardet copying src/cchardet/init.py -> build/lib.linux-aarch64-3.8/cchardet running build_ext building 'cchardet._cchardet' extension creating build/temp.linux-aarch64-3.8 creating build/temp.linux-aarch64-3.8/src creating build/temp.linux-aarch64-3.8/src/cchardet creating build/temp.linux-aarch64-3.8/src/ext creating build/temp.linux-aarch64-3.8/src/ext/uchardet creating build/temp.linux-aarch64-3.8/src/ext/uchardet/src creating build/temp.linux-aarch64-3.8/src/ext/uchardet/src/LangModels aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isrc/ext/uchardet/src -I/usr/include/python3.8 -c src/cchardet/_cchardet.cpp -o build/temp.linux-aarch64-3.8/src/cchardet/_cchardet.o src/cchardet/_cchardet.cpp:4:10: fatal error: Python.h: No such file or directory #include "Python.h" ^~~~~~~~~~ compilation terminated. error: command 'aarch64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /usr/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hxlmfkru/cchardet_ec84530a651448e8b7d54bd420b69736/setup.py'"'"'; file='"'"'/tmp/pip-install-hxlmfkru/cchardet_ec84530a651448e8b7d54bd420b69736/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-okdztqew/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/cchardet Check the logs for full command output.
Steps to reproduce the behavior
python3.8 -m pip install cchardet OR pip3 install cchardet
The same on:
- Python 3.10.1
- Lubuntu 20.04
UPDATE:
SOLVED
In my case, I solved the error by running:
apt-get install python3.10-dev
This is a different error than I ran into but since it failed initially on the same source code file, you may need to check some requirements. My error was due to cc1plus missing. I needed to install g++ since although gcc is installed by default, g++ is not (at least on ubuntu 20.04 for aarch64). This fixed my problem and cchardet now installs correctly. The source of your error may be similar.
Can confirm, you need to have gcc and g++ to install, as well as python3.X-dev