kakao / khaiii

Kakao Hangul Analyzer III
Apache License 2.0
1.41k stars 284 forks source link

설치시 에러가 발생합니다. #92

Closed sociengineer closed 4 years ago

sociengineer commented 4 years ago

안녕하세요~ 좋은 형태소 분석기를 개발하시고 공유해주셔서 감사합니다. python binding을 설치 중인데 에러가 나서 실행이 안되고 있습니다.ㅠㅠ zsh에서 sudo pip3 install . 로 입력하면 다음과 같은 에러가 뜨면서 설치에 실패합니다.

ERROR: Command errored out with exit status 1: command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-req-build-h92y6hrd/setup.py'"'"'; file='"'"'/private/tmp/pip-req-build-h92y6hrd/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 /private/tmp/pip-wheel-k4kpah90 cwd: /private/tmp/pip-req-build-h92y6hrd/ Complete output (27 lines): running bdist_wheel running build CMake Error: The source directory "/tmp/pip-req-build-h92y6hrd/khaiii-0.4" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. Traceback (most recent call last): File "", line 1, in File "/private/tmp/pip-req-build-h92y6hrd/setup.py", line 94, in cmdclass={'build': CustomBuild} File "/Users/wookjaemaeng/Library/Python/3.7/lib/python/site-packages/setuptools/init.py", line 144, in setup return distutils.core.setup(**attrs) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run self.run_command('build') File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/private/tmp/pip-req-build-h92y6hrd/setup.py", line 49, in run subprocess.check_call('cmake ..', cwd=build_dir, shell=True) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/subprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command 'cmake ..' returned non-zero exit status 1.

해결 방법을 알려주실 수 있을까요? 감사합니다.

krikit commented 4 years ago

지금 확인해보니 make package_python 명령을 빠뜨리신 것이 아닌가 추측됩니다. 아래 설치 문서를 참고하셔서 다시 한번 해보실 수 있을까요? https://github.com/kakao/khaiii/wiki/%EB%B9%8C%EB%93%9C-%EB%B0%8F-%EC%84%A4%EC%B9%98#python-%EB%B0%94%EC%9D%B8%EB%94%A9

sociengineer commented 4 years ago

알려주신대로 make를 포함한 명령어를 입력해도 에러가 해결되지 않았습니다ㅠㅠ make package_python cd package_python pip3 install .

make package_python를 실행하면 다음과 같은 메시지가 나오는데, 이 부분부터 잘못된 것일까요?

Run CPack packaging tool for source... CPack: Create package using ZIP CPack: Install projects CPack: - Install directory: /Users/wookjaemaeng/build/khaiii CPack: Create package CPack: - package: /Users/wookjaemaeng/build/khaiii/khaiii-0.4.zip generated. Built target package_python

krikit commented 4 years ago

khaiii 소스코드의 위치와 체크아웃한 버전을 좀 알려주세요. build 디렉터리를 어디에 만들었으며, cmake .. 명령을 실행하신 위치와 결과도 좀 알려주세요.

만약 /Users/wookjaemaeng/khaiii 아래가 khaiii 소스코드의 위치라면, /Users/wookjaemaeng/khaiii/build 디렉터리를 만들고 거기에 들어가서, cmake .. 명령을 수행한 다음 make pakcage_python와 같이 했다면 아래와 같은 메세지가 나와야 할 것 같습니다.

Run CPack packaging tool for source...
CPack: Create package using ZIP
CPack: Install projects
CPack: - Install directory: /Users/wookjaemaeng/khaiii
CPack: Create package
CPack: - package: /Users/wookjaemaeng/khaiii/build/khaiii-0.4.zip generated.
Built target package_python
sociengineer commented 4 years ago

Update khaiii 하위에 build에 설치되어야 하는데 khaiii/khaiii-0.4.zip generated로 생성된 것이 문제인가요?

khaiii의 소스코드 위치는 /Users/wookjaemaeng/build/khaiii 입니다. khaiii 안에 build라는 폴더도 있는데 빈 폴더입니다. cmake를 build에서 실행하면 CMakeList.txt파일이 없다고 에러가 나서 khaiii 디렉토리 안에서 실행했습니다.

wookjaemaeng@Wookjaeui-MacBookAir build % cmake .. -- [khaiii] fused multiply add option enabled -- [hunter] Calculating Toolchain-SHA1 -- [hunter] Calculating Config-SHA1 -- [hunter] HUNTER_ROOT: /Users/wookjaemaeng/.hunter -- [hunter] [ Hunter-ID: 70287b1 | Toolchain-ID: ece7c2f | Config-ID: b499eae ] -- [hunter] BOOST_ROOT: /Users/wookjaemaeng/.hunter/_Base/70287b1/ece7c2f/b499eae/Install (ver.: 1.68.0-p1) -- Boost version: 1.68.0 -- [hunter] CXXOPTS_ROOT: /Users/wookjaemaeng/.hunter/_Base/70287b1/ece7c2f/b499eae/Install (ver.: 2.1.1-pre) -- [hunter] EIGEN_ROOT: /Users/wookjaemaeng/.hunter/_Base/70287b1/ece7c2f/b499eae/Install (ver.: 3.3.5) -- [hunter] FMT_ROOT: /Users/wookjaemaeng/.hunter/_Base/70287b1/ece7c2f/b499eae/Install (ver.: 4.1.0) -- [hunter] GTEST_ROOT: /Users/wookjaemaeng/.hunter/_Base/70287b1/ece7c2f/b499eae/Install (ver.: 1.8.0-hunter-p11) -- [hunter] NLOHMANN_JSON_ROOT: /Users/wookjaemaeng/.hunter/_Base/70287b1/ece7c2f/b499eae/Install (ver.: 3.3.0) -- [hunter] SPDLOG_ROOT: /Users/wookjaemaeng/.hunter/_Base/70287b1/ece7c2f/b499eae/Install (ver.: 0.16.3-p1) -- Configuring done -- Generating done -- Build files have been written to: /Users/wookjaemaeng/build/khaiii

알려주신 방법대로 khaiii 디렉토리 하위에 build에 가서 cmake.. 이랑 make pakcage_python 실행하면 make: *** No rule to make target `pakcage_python'. Stop. 이라는 에러가 나옵니다..

khaiii 디렉토리에서 make package_python을 실행하면 다음과 같은 메시지가 나옵니다. wookjaemaeng@Wookjaeui-MacBookAir khaiii % make package_python Run CPack packaging tool for source... CPack: Create package using ZIP CPack: Install projects CPack: - Install directory: /Users/wookjaemaeng/build/khaiii CPack: Create package CPack: - package: /Users/wookjaemaeng/build/khaiii/khaiii-0.4.zip generated. Built target package_python

krikit commented 4 years ago

python 모듈 설치 시 setup.py 코드 내부에 cmake ..을 실행하는 부분이 있어서, 반드시 소스 디렉터리 아래에 build 디렉터리를 만들어야 합니다. /Users/wookjaemaeng/build/khaiii 이곳이 khaiii의 소스코드 위치가 맞다면, 일단 소스코드를 지우고 새로 받으신 다음, mkdir build 명령으로 /Users/wookjaemaeng/build/khaiii/build 디렉터리를 생성하시고, 이곳에서 cmake ..make package_python을 하셔서 /Users/wookjaemaeng/build/khaiii/build/package_python으로 이동하신 다음, pip install . 명령으로 python 모듈 빌드 및 설치를 진행하시기 바랍니다.

sociengineer commented 4 years ago

알려주신 방법대로 설치해서 해결되었습니다~ 친절하게 알려주셔서 정말 감사드립니다!!