opendatalab / magic-html

Apache License 2.0
276 stars 25 forks source link

在 macOS python3.11 下安装报错 #15

Open kkew3 opened 2 months ago

kkew3 commented 2 months ago

可否把

https://github.com/opendatalab/magic-html/blob/1c44bd5f92c488c24326fcc55167aaed15285439/requirements.txt#L2

改为 cchardet==2.2.0a2(见这个 issue)?否则在 python3.11 下报错。我显式指定安装 cchardet==2.2.0a2 后可以正常运行 README 里的例子。

报错信息如下:

Building wheels for collected packages: cchardet, docopt
  Building wheel for cchardet (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for cchardet (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-311
      creating build/lib.macosx-10.9-universal2-cpython-311/cchardet
      copying src/cchardet/version.py -> build/lib.macosx-10.9-universal2-cpython-311/cchardet
      copying src/cchardet/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/cchardet
      running build_ext
      building 'cchardet._cchardet' extension
      creating build/temp.macosx-10.9-universal2-cpython-311
      creating build/temp.macosx-10.9-universal2-cpython-311/src
      creating build/temp.macosx-10.9-universal2-cpython-311/src/cchardet
      creating build/temp.macosx-10.9-universal2-cpython-311/src/ext
      creating build/temp.macosx-10.9-universal2-cpython-311/src/ext/uchardet
      creating build/temp.macosx-10.9-universal2-cpython-311/src/ext/uchardet/src
      creating build/temp.macosx-10.9-universal2-cpython-311/src/ext/uchardet/src/LangModels
      clang++ -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -Isrc/ext/uchardet/src -I/Users/kw/Documents/Projects/python3/proj/magic-html/venv/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/cchardet/_cchardet.cpp -o build/temp.macosx-10.9-universal2-cpython-311/src/cchardet/_cchardet.o
      src/cchardet/_cchardet.cpp:196:12: fatal error: 'longintrepr.h' file not found
        #include "longintrepr.h"
                 ^~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang++' 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 cchardet
sixgad commented 2 months ago

@kkew3 感谢Kaiwen的建议,cchardet==2.2.0a2当前是预发布版本,下阶段抽取任务大规模验证后更新上线。

Tendo33 commented 2 months ago

Same problem here. I can't even install it now.

sixgad commented 2 months ago

@Tendo33 If the issue is that cchardet cannot compile in a higher version Python environment, you can try specifying the installation of cchardet alpha version. The specific steps are as follows:

  1. pip install cchardet==2.2.0a2
  2. pip install https://github.com/opendatalab/magic-html/releases/download/magic_html-0.1.2-released/magic_html-0.1.2-py3-none-any.whl