Giter VIP home page Giter VIP logo

python-mecab-ko's People

Contributors

diligejy avatar jonghwanhyeon avatar soyoung97 avatar woowahan-jaehoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

python-mecab-ko's Issues

AssertionError 관련

빌드 문제는 해결되었는데요, 이번엔 AssertionError가 발생하네요.

>>> import mecab
>>> m = mecab.MeCab()
>>> m.parse('학생부종합전형으로는 수시모집 선발인원의 약 58%인 1173명을 선발한다.')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/djlee/workspace/python/mecab-ko-dic/.venv/lib/python3.7/site-packages/mecab/mecab.py", line 62, in parse
    for node in lattice
  File "/home/djlee/workspace/python/mecab-ko-dic/.venv/lib/python3.7/site-packages/mecab/mecab.py", line 62, in <listcomp>
    for node in lattice
  File "/home/djlee/workspace/python/mecab-ko-dic/.venv/lib/python3.7/site-packages/mecab/mecab.py", line 33, in _extract_feature
    assert len(values) == 8
AssertionError

Originally posted by @dongjinleekr in #9 (comment)

pybind11 오류

안녕하세요?
설치 후, 테스트를 해보니 아래와 같이 pybind11 type error 발생하는데 도움을 주실 수 있으실까요?
pybind11 은 pybind11-2.7.1-py2.py3-none-any.whl 을 다운 받아 설치 하였습니다.

import mecab
m=mecab.MeCab()
,,,,,,,,,,,, /mecab/mecab.py in init.py(self, dicpath)
51 argument = '-d %s' % dicpath
52
53 self.tagger = _mecab.Tagger(argument)
54
55 def parse(self, sentence):

TypeError: pybind11::init()Lfactory function returned nullptr

windows OS에서 setup.py의 get_mecab_include_directory오류입니다.

windows환경에서 설치가 진행되지 않습니다.
setup에서 Extension에서 발생합니다.
확실하진 않지만 제가 살펴본 바로는
library_dirs, runtime_library_dirs에서의
get_mecab_library_directory()가 원인인 것 같습니다.

오류내용

Traceback (most recent call last):
  File "C:/Users/82109/Desktop/pmk/test.py", line 11, in <module>
    print(get_mecab_include_directory())
  File "C:/Users/82109/Desktop/pmk/test.py", line 10, in get_mecab_include_directory
    'mecab-config', '--inc-dir']).decode('utf-8').strip()
  File "C:\Users\82109\anaconda3\envs\pmk\lib\subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "C:\Users\82109\anaconda3\envs\pmk\lib\subprocess.py", line 488, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\82109\anaconda3\envs\pmk\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "C:\Users\82109\anaconda3\envs\pmk\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 지정된 파일을 찾을 수 없습니다

install-mecab-ko.py에서도 오류가 발생합니다.
PermissionError: [WinError 32] 다른 프로세스가 파일을 사용 중이기 때문에 프로세스가 액세스 할 수 없습니다: 'C:\\Users\\82109\\AppData\\Local\\Temp\\tmp3ulaknyn'

위의 2개의 오류가 windows에서 설치가 잘 안되는 원인 같습니다.
그리고 위의 오류 2개 다 subprocess가 원인인 것 같습니다.

어떻게 해결해야 할까요?

아래는 오류 전문입니다.

(pmk) C:\Users\82109\Desktop\pmk>pip install -v python-mecab-ko
Using pip 22.2.2 from C:\Users\82109\anaconda3\envs\pmk\lib\site-packages\pip (pyth
on 3.7)
Collecting python-mecab-ko
  Using cached python-mecab-ko-1.0.14.tar.gz (9.6 kB)
  Running command python setup.py egg_info
  running egg_info
  creating C:\Users\82109\AppData\Local\Temp\pip-pip-egg-info-_7lckiqg\python_mecab
_ko.egg-info
  writing C:\Users\82109\AppData\Local\Temp\pip-pip-egg-info-_7lckiqg\python_mecab_
ko.egg-info\PKG-INFO
  writing dependency_links to C:\Users\82109\AppData\Local\Temp\pip-pip-egg-info-_7
lckiqg\python_mecab_ko.egg-info\dependency_links.txt
  writing requirements to C:\Users\82109\AppData\Local\Temp\pip-pip-egg-info-_7lcki
qg\python_mecab_ko.egg-info\requires.txt
  writing top-level names to C:\Users\82109\AppData\Local\Temp\pip-pip-egg-info-_7l
ckiqg\python_mecab_ko.egg-info\top_level.txt
  writing manifest file 'C:\Users\82109\AppData\Local\Temp\pip-pip-egg-info-_7lckiq
g\python_mecab_ko.egg-info\SOURCES.txt'
  reading manifest file 'C:\Users\82109\AppData\Local\Temp\pip-pip-egg-info-_7lckiq
g\python_mecab_ko.egg-info\SOURCES.txt'
  adding license file 'LICENSE'
  writing manifest file 'C:\Users\82109\AppData\Local\Temp\pip-pip-egg-info-_7lckiq
g\python_mecab_ko.egg-info\SOURCES.txt'
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pybind11~=2.9.0 in c:\users\82109\anaconda3\envs\pmk
\lib\site-packages (from python-mecab-ko) (2.9.2)
Building wheels for collected packages: python-mecab-ko
  Running command python setup.py bdist_wheel
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-37
  creating build\lib.win-amd64-cpython-37\mecab
  copying mecab\mecab.py -> build\lib.win-amd64-cpython-37\mecab
  copying mecab\__init__.py -> build\lib.win-amd64-cpython-37\mecab
  running build_ext
  building '_mecab' extension
  error: [WinError 2] 지정된 파일을 찾을 수 없습니다
  error: subprocess-exited-with-error
  
  × python setup.py bdist_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 p
ip.
  full command: 'C:\Users\82109\anaconda3\envs\pmk\python.exe' -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py      
  #
  # - It imports setuptools before invoking setup.py, to enable projects that direc
tly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` 
so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following wa
rning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'C:\\Users\\82109\\AppData\\Local\\Temp\\pip-install-qfqax
q3z\\python-mecab-ko_926168434e5344e2abc3943fd65de3c5\\setup.py'"'"',), "<pip-setup
tools-caller>", "exec"))' bdist_wheel -d 'C:\Users\82109\AppData\Local\Temp\pip-whe
el-hmnrdlzp'
  cwd: C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92616
8434e5344e2abc3943fd65de3c5\
  Building wheel for python-mecab-ko (setup.py) ... error
  ERROR: Failed building wheel for python-mecab-ko
  Running setup.py clean for python-mecab-ko
  Running command python setup.py clean
  running clean
  removing 'build\lib.win-amd64-cpython-37' (and everything under it)
  'build\bdist.win-amd64' does not exist -- can't clean it
  'build\scripts-3.7' does not exist -- can't clean it
  removing 'build'
Failed to build python-mecab-ko
Installing collected packages: python-mecab-ko
  Running command Running setup.py install for python-mecab-ko
  running install
  C:\Users\82109\anaconda3\envs\pmk\lib\site-packages\setuptools\command\install.py
:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pi
p and other standards-based tools.
    setuptools.SetuptoolsDeprecationWarning,
  Installing mecab-ko...
  Traceback (most recent call last):
    File "C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92
6168434e5344e2abc3943fd65de3c5\scripts\install-mecab-ko.py", line 72, in install   
      download(url)
    File "C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92
6168434e5344e2abc3943fd65de3c5\scripts\install-mecab-ko.py", line 53, in download  
      ], check=True)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\subprocess.py", line 488, in run   
      with Popen(*popenargs, **kwargs) as process:
    File "C:\Users\82109\anaconda3\envs\pmk\lib\subprocess.py", line 800, in __init
__
      restore_signals, start_new_session)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\subprocess.py", line 1207, in _exec
ute_child
      startupinfo)
  FileNotFoundError: [WinError 2] 지정된 파일을 찾을 수 없습니다

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92
6168434e5344e2abc3943fd65de3c5\scripts\install-mecab-ko.py", line 80, in <module>  
      '--enable-utf8-only')
    File "C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92
6168434e5344e2abc3943fd65de3c5\scripts\install-mecab-ko.py", line 74, in install   
      make()
    File "C:\Users\82109\anaconda3\envs\pmk\lib\tempfile.py", line 807, in __exit__
      self.cleanup()
    File "C:\Users\82109\anaconda3\envs\pmk\lib\tempfile.py", line 811, in cleanup 
      _shutil.rmtree(self.name)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\shutil.py", line 516, in rmtree    
      return _rmtree_unsafe(path, onerror)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\shutil.py", line 404, in _rmtree_un
safe
      onerror(os.rmdir, path, sys.exc_info())
    File "C:\Users\82109\anaconda3\envs\pmk\lib\shutil.py", line 402, in _rmtree_un
safe
      os.rmdir(path)
  PermissionError: [WinError 32] 다른 프로세스가 파일을 사용 중이기 때문에 프로세스
가 액세스 할 수 없습니다: 'C:\\Users\\82109\\AppData\\Local\\Temp\\tmpijx2pskb'    
  Traceback (most recent call last):
    File "<string>", line 36, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92
6168434e5344e2abc3943fd65de3c5\setup.py", line 179, in <module>
      'build_ext': BuildExtensionCommand
    File "C:\Users\82109\anaconda3\envs\pmk\lib\site-packages\setuptools\__init__.p
y", line 87, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\site-packages\setuptools\_distutils
\core.py", line 185, in setup
      return run_commands(dist)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\site-packages\setuptools\_distutils
\core.py", line 201, in run_commands
      dist.run_commands()
    File "C:\Users\82109\anaconda3\envs\pmk\lib\site-packages\setuptools\_distutils
\dist.py", line 973, in run_commands
      self.run_command(cmd)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\site-packages\setuptools\dist.py", 
line 1217, in run_command
      super().run_command(command)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\site-packages\setuptools\_distutils
\dist.py", line 992, in run_command
      cmd_obj.run()
    File "C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92
6168434e5344e2abc3943fd65de3c5\setup.py", line 76, in run
      self.install_mecab()
    File "C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92
6168434e5344e2abc3943fd65de3c5\setup.py", line 85, in install_mecab
      cwd=scripts_directory)
    File "C:\Users\82109\anaconda3\envs\pmk\lib\subprocess.py", line 363, in check_
call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['C:\\Users\\82109\\anaconda3\\envs\\pmk\
\python.exe', 'C:\\Users\\82109\\AppData\\Local\\Temp\\pip-install-qfqaxq3z\\python
-mecab-ko_926168434e5344e2abc3943fd65de3c5\\scripts\\install-mecab-ko.py']' returne
d non-zero exit status 1.
  error: subprocess-exited-with-error

  × Running setup.py install for python-mecab-ko 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 p
ip.
  full command: 'C:\Users\82109\anaconda3\envs\pmk\python.exe' -u -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py      
  #
  # - It imports setuptools before invoking setup.py, to enable projects that direc
tly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` 
so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following wa
rning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'C:\\Users\\82109\\AppData\\Local\\Temp\\pip-install-qfqax
q3z\\python-mecab-ko_926168434e5344e2abc3943fd65de3c5\\setup.py'"'"',), "<pip-setup
tools-caller>", "exec"))' install --record 'C:\Users\82109\AppData\Local\Temp\pip-r
ecord-qsmv3oqf\install-record.txt' --single-version-externally-managed --compile --
install-headers 'C:\Users\82109\anaconda3\envs\pmk\Include\python-mecab-ko'        
  cwd: C:\Users\82109\AppData\Local\Temp\pip-install-qfqaxq3z\python-mecab-ko_92616
8434e5344e2abc3943fd65de3c5\
  Running setup.py install for python-mecab-ko ... error
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-mecab-ko

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Docker 내의 Anaconda 환경에서 설치가 되지 않고 있습니다.

Docker 안에서 conda를 이용하여 가상환경을 구축하여 사용하고 있습니다만, 설치가 되지 않는 것을 확인하였습니다.
메시지를 추적한 결과

  building '_mecab' extension
  error: [Errno 2] No such file or directory: '/opt/conda/bin/mecab-config': '/opt/conda/bin/mecab-config'
error
  ERROR: Failed building wheel for python-mecab-ko

부터 오류가 발생하는 것으로 보입니다. 해결 방안을 알려주신다면 감사드리겠습니다.

TypeError: pybind11::init(): factory function returned nullptr

안녕하세요,

좋은 라이브러리를 만들어주셔서 감사합니다.
다만 제가 사용하는 와중에 에러가 발생해서 문의드립니다.

Encountered Error

import mecab
mecab = mecab.MeCab()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/ipykernel_31265/2337645710.py in <module>
      1 import mecab
----> 2 mecab = mecab.MeCab()

~/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/mecab/mecab.py in __init__(self, dicpath)
     51             argument = '-d %s' % dicpath
     52 
---> 53         self.tagger = _mecab.Tagger(argument)
     54 
     55     def parse(self, sentence):

TypeError: pybind11::init(): factory function returned nullptr

Environment

  • OS: macOS Catalina version 10.15.7
  • Virtual Environment: pyenv, python 3.8.3, pip 21.2.4

Suspected Reason

가상환경에 pip install -v python-mecab-ko 명령어를 입력했고 설치 메세지를 하단에 첨부하였습니다.
ERROR: Failed building wheel for python-mecab-ko 부분이 해당 에러와 연관이 있을까요?

Collecting python-mecab-ko
  Downloading python-mecab-ko-1.0.12.tar.gz (9.7 kB)
    Running command python setup.py egg_info
    running egg_info
    creating /private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-pip-egg-info-x1pa9x7e/python_mecab_ko.egg-info
    writing /private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-pip-egg-info-x1pa9x7e/python_mecab_ko.egg-info/PKG-INFO
    writing dependency_links to /private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-pip-egg-info-x1pa9x7e/python_mecab_ko.egg-info/dependency_links.txt
    writing requirements to /private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-pip-egg-info-x1pa9x7e/python_mecab_ko.egg-info/requires.txt
    writing top-level names to /private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-pip-egg-info-x1pa9x7e/python_mecab_ko.egg-info/top_level.txt
    writing manifest file '/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-pip-egg-info-x1pa9x7e/python_mecab_ko.egg-info/SOURCES.txt'
    reading manifest file '/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-pip-egg-info-x1pa9x7e/python_mecab_ko.egg-info/SOURCES.txt'
    writing manifest file '/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-pip-egg-info-x1pa9x7e/python_mecab_ko.egg-info/SOURCES.txt'
Collecting pybind11~=2.0
  Downloading pybind11-2.8.1-py2.py3-none-any.whl (208 kB)
     |████████████████████████████████| 208 kB 10.8 MB/s 
Building wheels for collected packages: python-mecab-ko
  Running command /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py'"'"'; __file__='"'"'/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-wheel-qd42g16i
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.15-x86_64-3.8
  creating build/lib.macosx-10.15-x86_64-3.8/mecab
  copying mecab/mecab.py -> build/lib.macosx-10.15-x86_64-3.8/mecab
  copying mecab/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/mecab
  running build_ext
  creating var
  creating var/folders
  creating var/folders/f8
  creating var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn
  creating var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c /var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/tmpw5_bo5mq.cpp -o var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/tmpw5_bo5mq.o -std=c++14
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c /var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/tmpqpy_i80_.cpp -o var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/tmpqpy_i80_.o -fvisibility=hidden
  building '_mecab' extension
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py", line 127, in <module>
      setup(
    File "/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 84, in run
      _build_ext.run(self)
    File "/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
      _build_ext.build_ext.run(self)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/command/build_ext.py", line 340, in run
      self.build_extensions()
    File "/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py", line 43, in build_extensions
      super().build_extensions()
    File "/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
      _build_ext.build_ext.build_extensions(self)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
      self._build_extensions_serial()
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
      self.build_extension(ext)
    File "/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 205, in build_extension
      _build_ext.build_extension(self, ext)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension
      objects = self.compiler.compile(sources,
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/ccompiler.py", line 565, in compile
      self._setup_compile(output_dir, macros, include_dirs, sources,
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/ccompiler.py", line 341, in _setup_compile
      pp_opts = gen_preprocess_options(macros, incdirs)
    File "/Users/noopy/.pyenv/versions/3.8.3/lib/python3.8/distutils/ccompiler.py", line 1076, in gen_preprocess_options
      pp_opts.append("-I%s" % dir)
    File "/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py", line 95, in __str__
      return func(*self.args, **self.kwargs)
    File "/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py", line 108, in get_pybind_include
      import pybind11
  ModuleNotFoundError: No module named 'pybind11'
  Building wheel for python-mecab-ko (setup.py) ... error
  ERROR: Failed building wheel for python-mecab-ko
  Running setup.py clean for python-mecab-ko
  Running command /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py'"'"'; __file__='"'"'/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
  running clean
  removing 'build/lib.macosx-10.15-x86_64-3.8' (and everything under it)
  'build/bdist.macosx-10.15-x86_64' does not exist -- can't clean it
  'build/scripts-3.8' does not exist -- can't clean it
  removing 'build'
Failed to build python-mecab-ko
Installing collected packages: pybind11, python-mecab-ko
  changing mode of /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/bin/pybind11-config to 755
    Running command /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py'"'"'; __file__='"'"'/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-install-ebh7m4yr/python-mecab-ko_c9a1e70c8f7a40478847d2da0decfe64/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-record-a4g5xbwc/install-record.txt --single-version-externally-managed --compile --install-headers /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include/site/python3.8/python-mecab-ko
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.15-x86_64-3.8
    creating build/lib.macosx-10.15-x86_64-3.8/mecab
    copying mecab/mecab.py -> build/lib.macosx-10.15-x86_64-3.8/mecab
    copying mecab/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/mecab
    running build_ext
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c /var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/tmp_9tfjp0a.cpp -o var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/tmp_9tfjp0a.o -std=c++14
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c /var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/tmp6csgssk3.cpp -o var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/tmp6csgssk3.o -fvisibility=hidden
    building '_mecab' extension
    creating build/temp.macosx-10.15-x86_64-3.8
    creating build/temp.macosx-10.15-x86_64-3.8/mecab
    creating build/temp.macosx-10.15-x86_64-3.8/mecab/pybind
    creating build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/usr/local/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c mecab/pybind/_mecab/node.cpp -o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/node.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="1.0.12" -std=c++14 -fvisibility=hidden
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/usr/local/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c mecab/pybind/_mecab/path.cpp -o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/path.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="1.0.12" -std=c++14 -fvisibility=hidden
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/usr/local/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c mecab/pybind/_mecab/lattice.cpp -o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/lattice.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="1.0.12" -std=c++14 -fvisibility=hidden
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/usr/local/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c mecab/pybind/_mecab/dictionaryinfo.cpp -o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/dictionaryinfo.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="1.0.12" -std=c++14 -fvisibility=hidden
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/usr/local/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c mecab/pybind/_mecab/tagger.cpp -o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/tagger.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="1.0.12" -std=c++14 -fvisibility=hidden
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/pybind11/include -I/usr/local/include -I/Users/noopy/.pyenv/versions/3.8.3/envs/aitech/include -I/Users/noopy/.pyenv/versions/3.8.3/include/python3.8 -c mecab/pybind/_mecab/_mecab.cpp -o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/_mecab.o -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO="1.0.12" -std=c++14 -fvisibility=hidden
    clang++ -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/noopy/.pyenv/versions/3.8.3/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/noopy/.pyenv/versions/3.8.3/lib build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/node.o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/path.o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/lattice.o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/dictionaryinfo.o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/tagger.o build/temp.macosx-10.15-x86_64-3.8/mecab/pybind/_mecab/_mecab.o -L/usr/local/lib -L/usr/local/lib -lmecab -o build/lib.macosx-10.15-x86_64-3.8/_mecab.cpython-38-darwin.so
    running install_lib
    copying build/lib.macosx-10.15-x86_64-3.8/_mecab.cpython-38-darwin.so -> /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages
    creating /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/mecab
    copying build/lib.macosx-10.15-x86_64-3.8/mecab/mecab.py -> /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/mecab
    copying build/lib.macosx-10.15-x86_64-3.8/mecab/__init__.py -> /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/mecab
    byte-compiling /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/mecab/mecab.py to mecab.cpython-38.pyc
    byte-compiling /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/mecab/__init__.py to __init__.cpython-38.pyc
    running install_data
    creating /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/scripts
    copying scripts/install-mecab-ko.py -> /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/scripts
    running install_egg_info
    running egg_info
    writing python_mecab_ko.egg-info/PKG-INFO
    writing dependency_links to python_mecab_ko.egg-info/dependency_links.txt
    writing requirements to python_mecab_ko.egg-info/requires.txt
    writing top-level names to python_mecab_ko.egg-info/top_level.txt
    reading manifest file 'python_mecab_ko.egg-info/SOURCES.txt'
    writing manifest file 'python_mecab_ko.egg-info/SOURCES.txt'
    Copying python_mecab_ko.egg-info to /Users/noopy/.pyenv/versions/3.8.3/envs/aitech/lib/python3.8/site-packages/python_mecab_ko-1.0.12-py3.8.egg-info
    running install_scripts
    writing list of installed files to '/private/var/folders/f8/9hn0rsx125vf87jp8_skr1l40000gn/T/pip-record-a4g5xbwc/install-record.txt'
    Running setup.py install for python-mecab-ko ... done
  DEPRECATION: python-mecab-ko was installed using the legacy 'setup.py install' method, because a wheel could not be built for it. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.

Successfully installed pybind11-2.8.1 python-mecab-ko-1.0.12

python 패키지 설치 시, 시스템 라이브러리(mecab-ko) 설치는 권장되지 않습니다.

python-mecab-ko/setup.py

Lines 49 to 52 in 5af8335

sys.stderr.write(
"$ wget https://raw.githubusercontent.com/jonghwanhyeon/python-mecab-ko/main/scripts/install_mecab_ko.py\n"
)
sys.stderr.write("$ python3 install_mecab_ko.py\n")

해당 패키지 설치시, 시스템 라이브러리 mecab-ko에 대한 설치도 유도되고 있는데요.

이는 권장되지 않는 방식으로 시스템 라이브러리 설치는 따로 분리하여 별도로 실행할 수 있도록 하는 것이 좋겠습니다.

보안 문제가 있을 수 있으며, 이미 해당 시스템 라이브러리가 설치 되어 있는 장치에서는 충돌이 발생할 수 있습니다. (mecab-config 명령어를 통해서 설치여부를 확인하나 사용자가 PATH에 (의도했든 안 했든) 등록 안 했을 수 있습니다.)

Unable to install in a virtualenv with pyenv

Dear maintainers, when I tried to install pip install python-mecab-ko in a virtualenv with pyenv, I have received the following errors:

shun.liang@B-1170  ~/mecab-ko-test  pyenv --version
pyenv 1.2.16
 shun.liang@B-1170  ~/mecab-ko-test  pyenv virtualenv 3.6.8 mecab-ko-test
Using base prefix '/Users/shun.liang/.pyenv/versions/3.6.8'
New python executable in /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python3.6
Also creating executable in /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python
Installing setuptools, pip, wheel...
done.
Looking in links: /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp46dhgc65
Requirement already satisfied: setuptools in /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages (45.2.0)
Requirement already satisfied: pip in /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages (20.0.2)
 shun.liang@B-1170  ~/mecab-ko-test  pyenv activate mecab-ko-test
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(mecab-ko-test)  shun.liang@B-1170  ~/mecab-ko-test  pip install python-mecab-ko
Looking in indexes: https://pypi.org/simple, <redacted>
Collecting python-mecab-ko
  Using cached python-mecab-ko-1.0.8.tar.gz (6.7 kB)
Collecting pybind11~=2.0
  Using cached pybind11-2.4.3-py2.py3-none-any.whl (150 kB)
Building wheels for collected packages: python-mecab-ko
  Building wheel for python-mecab-ko (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"'; __file__='"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/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/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-wheel-qwpi5ati
       cwd: /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/
  Complete output (66 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-x86_64-3.6
  creating build/lib.macosx-10.13-x86_64-3.6/mecab
  copying mecab/mecab.py -> build/lib.macosx-10.13-x86_64-3.6/mecab
  copying mecab/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/mecab
  running build_ext
  creating var
  creating var/folders
  creating var/folders/gj
  creating var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr
  creating var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/shun.liang/.pyenv/versions/3.6.8/include/python3.6m -c /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp4ps69iwa.cpp -o var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp4ps69iwa.o -std=c++14
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/shun.liang/.pyenv/versions/3.6.8/include/python3.6m -c /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp_8bky15n.cpp -o var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp_8bky15n.o -fvisibility=hidden
  building '_mecab' extension
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py", line 178, in <module>
      'build_ext': BuildExtensionCommand
    File "/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
      return distutils.core.setup(**attrs)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 223, in run
      self.run_command('build')
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 87, in run
      _build_ext.run(self)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build_ext.py", line 339, in run
      self.build_extensions()
    File "/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py", line 42, in build_extensions
      super().build_extensions()
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
      self._build_extensions_serial()
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
      self.build_extension(ext)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 208, in build_extension
      _build_ext.build_extension(self, ext)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
      depends=ext.depends)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/ccompiler.py", line 566, in compile
      depends, extra_postargs)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/ccompiler.py", line 341, in _setup_compile
      pp_opts = gen_preprocess_options(macros, incdirs)
    File "/Users/shun.liang/.pyenv/versions/3.6.8/lib/python3.6/distutils/ccompiler.py", line 1075, in gen_preprocess_options
      pp_opts.append("-I%s" % dir)
    File "/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py", line 94, in __str__
      return func(*self.args, **self.kwargs)
    File "/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py", line 107, in get_pybind_include
      import pybind11
  ModuleNotFoundError: No module named 'pybind11'
  ----------------------------------------
  ERROR: Failed building wheel for python-mecab-ko
  Running setup.py clean for python-mecab-ko
Failed to build python-mecab-ko
Installing collected packages: pybind11, python-mecab-ko
    Running setup.py install for python-mecab-ko ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"'; __file__='"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-record-z0z4pbay/install-record.txt --single-version-externally-managed --compile --install-headers /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/include/site/python3.6/python-mecab-ko
         cwd: /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/
    Complete output (13 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-x86_64-3.6
    creating build/lib.macosx-10.13-x86_64-3.6/mecab
    copying mecab/mecab.py -> build/lib.macosx-10.13-x86_64-3.6/mecab
    copying mecab/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/mecab
    running build_ext
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/shun.liang/.pyenv/versions/3.6.8/include/python3.6m -c /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp424r_q5w.cpp -o var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp424r_q5w.o -std=c++14
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/shun.liang/.pyenv/versions/3.6.8/include/python3.6m -c /var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp2ymetpou.cpp -o var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/tmp2ymetpou.o -fvisibility=hidden
    building '_mecab' extension
    error: [Errno 2] No such file or directory: '/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/mecab-config': '/Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/mecab-config'
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"'; __file__='"'"'/private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-install-ofc9hnz1/python-mecab-ko/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/gj/ynfp5z3x2g32ypkwvjq34699y7tntr/T/pip-record-z0z4pbay/install-record.txt --single-version-externally-managed --compile --install-headers /Users/shun.liang/.pyenv/versions/3.6.8/envs/mecab-ko-test/include/site/python3.6/python-mecab-ko Check the logs for full command output.

It seems there are two source of problems:

  1. During the installation, the dependency pybind11 cannot be found.
  2. The install-mecab-ko.py script tries to find mecab-config under sys.config's bin, but if Python is run within a virtualenv, then sys.prefix won't be the default /user/local.

Can I ask if you are able to advise? Many thanks.

Error on import mecab on macOS

Hi, I use OS X 10.11 with Python 3.10.11 and everything works fine for python-mecab-ko 1.3.3. But after upgrading to python-mecab-ko 1.3.5, an error occurs on import mecab:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mecab/__init__.py", line 1, in <module>
    from .mecab import MeCab, MeCabError, mecabrc_path
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mecab/mecab.py", line 8, in <module>
    import _mecab
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_mecab.cpython-310-darwin.so, 2): Library not loaded: @loader_path/mecab/.dylibs/libmecab.2.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/_mecab.cpython-310-darwin.so
  Reason: no suitable image found.  Did find:
	/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mecab/.dylibs/libmecab.2.dylib: cannot load 'libmecab.2.dylib' (load command 0x80000034 is unknown)
	/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mecab/.dylibs/libmecab.2.dylib: cannot load 'libmecab.2.dylib' (load command 0x80000034 is unknown)

There are also some issues when running tests on CI (Github Actions and Azure Pipelines) with macOS 11:

../../../hostedtoolcache/Python/3.10.13/x64/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/tests_nlp/tests_spacy/test_spacy_eng.py:19: in <module>
    from tests.tests_nlp.tests_spacy import test_spacy
tests/tests_nlp/tests_spacy/test_spacy.py:19: in <module>
    from tests import wl_test_init, wl_test_lang_examples
tests/wl_test_init.py:[29](https://github.com/BLKSerene/Wordless/actions/runs/9136231662/job/25124740125#step:5:30): in <module>
    from tests import wl_test_file_area
tests/wl_test_file_area.py:28: in <module>
    from wordless import wl_file_area
wordless/wl_file_area.py:38: in <module>
    from wordless.wl_checks import wl_checks_files, wl_checks_misc
wordless/wl_checks/wl_checks_files.py:24: in <module>
    from wordless.wl_checks import wl_checks_work_area
wordless/wl_checks/wl_checks_work_area.py:25: in <module>
    from wordless.wl_dialogs import wl_dialogs_errs, wl_msg_boxes
wordless/wl_dialogs/wl_dialogs_errs.py:23: in <module>
    from wordless.wl_widgets import wl_labels, wl_tables
wordless/wl_widgets/wl_tables.py:37: in <module>
    from wordless.wl_nlp import wl_nlp_utils
wordless/wl_nlp/wl_nlp_utils.py:[31](https://github.com/BLKSerene/Wordless/actions/runs/9136231662/job/25124740125#step:5:32): in <module>
    import mecab
../../../hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/mecab/__init__.py:1: in <module>
    from .mecab import MeCab, MeCabError, mecabrc_path
../../../hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/mecab/mecab.py:8: in <module>
    import _mecab
E   ImportError: dlopen(/Users/runner/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/_mecab.cpython-310-darwin.so, 2): Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
E     Referenced from: /Users/runner/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/mecab/.dylibs/libmecab.2.dylib (which was built for Mac OS X 13.0)
E     Expected in: /usr/lib/libc++.1.dylib

It works with Xcode 14.1 on CI.

Add a method that returns all the original features.

Hi,

The original mecab-ko returns many features, but this repo and konlpy extract only the first one, POS tag.
I guess it's useful if you add a method that returns all the features like this:

def analyze(self, sentence):
        lattice = _create_lattice(sentence)
        if not self.tagger.parse(lattice):
            raise MeCabError(self.tagger.what())

        return [
            (node.surface, node.feature)
            for node in lattice
        ]

GCP AI Platform(Debian 4.x)에서 실행 오류

GCP AI Platform에서 제공하는 리눅스 최신 버전(4.19.0-13-cloud-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux)에서 실행이 되지 않습니다. 팩키징된 so 파일은 물론, 직접 소스를 내려 받아 빌드해도 빌드할때 오류는 발생하지 않으나 import시에 undefined symbol: libiconv 오류가 발생합니다.

>>> import mecab
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.7/site-packages/mecab/__init__.py", line 1, in <module>
    from .mecab import MeCabError
  File "/opt/conda/lib/python3.7/site-packages/mecab/mecab.py", line 1, in <module>
    import _mecab
ImportError: /opt/conda/lib/libmecab.so.2: undefined symbol: libiconv

아마 libiconv.so가 최신 버전에서 통합된 영향을 받지 않나 싶은데, 현재는 동작하지 않고 있습니다.

macos catalina 에서 설치 오류 문의

안녕하세요. macOS Catalina 에서 설치시 아래와 같은 오류가 발생해서 문의드립니다.
OS Version: 10.15.7
python version: 3.7.9
zsh version: 5.8

처음에는 subprocess.run(['./configure', *args], check=True) 명령을 실행하다가 오류가 발생했는데,
brew update && brew upgrade한 후부터는 아래와 같은 오류가 발생합니다.

building '_mecab' extension
    error: [Errno 2] No such file or directory: '/Users/.../python-mecab-ko/.venv/bin/mecab-config': '/Users/.../python-mecab-ko/.venv/bin/mecab-config'
    Running setup.py install for python-mecab-ko ... error
ERROR: Command errored out with exit status 1: /Users/.../python-mecab-ko/.venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t8/bq_crmxj3ml174k1sj_x31k40000gn/T/pip-req-build-s70gt3ui/setup.py'"'"'; __file__='"'"'/private/var/folders/t8/bq_crmxj3ml174k1sj_x31k40000gn/T/pip-req-build-s70gt3ui/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t8/bq_crmxj3ml174k1sj_x31k40000gn/T/pip-record-qtvmtyuf/install-record.txt --single-version-externally-managed --compile --install-headers /Users/.../python-mecab-ko/.venv/include/site/python3.7/python-mecab-ko Check the logs for full command output.

좋은 라이브러리 제공해주셔서 잘 사용하고 있습니다.
감사의 말씀을 드립니다.

설치가 되지 않습니다.

안녕하세요. 다음과 같은 오류가 나오면서 설치가 되지 않아 문의드리고자 글을 올립니다.
pip install -v python-mecab-ko 및 pip install python-mecab-ko 둘 다로 했는데 모두 설치가 되지 않았습니다.

혹시나 해결 방법을 알려주시면 감사하겠습니다.

Using pip 20.3.3 from C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip (python 3.7)
Non-user install because site-packages writeable
Created temporary directory: C:\Users\ppkpp\AppData\Local\Temp\pip-ephem-wheel-cache-lgwyzj0j
Created temporary directory: C:\Users\ppkpp\AppData\Local\Temp\pip-req-tracker-7waftkab
Initialized build tracking at C:\Users\ppkpp\AppData\Local\Temp\pip-req-tracker-7waftkab
Created build tracker: C:\Users\ppkpp\AppData\Local\Temp\pip-req-tracker-7waftkab
Entered build tracker: C:\Users\ppkpp\AppData\Local\Temp\pip-req-tracker-7waftkab
Created temporary directory: C:\Users\ppkpp\AppData\Local\Temp\pip-install-fboj3ji5
1 location(s) to search for versions of python-mecab-ko:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_internal\cli\base_command.py", line 224, in main
status = self.run(options, args)
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_internal\cli\req_command.py", line 180, in wrapper
return func(self, options, args)
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_internal\commands\install.py", line 403, in run
pycompile=options.compile,
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_internal\req_init
.py", line 90, in install_given_reqs
pycompile=pycompile,
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_internal\req\req_install.py", line 858, in install
six.reraise(*exc.parent)
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_vendor\six.py", line 703, in reraise
raise value
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_internal\operations\install\legacy.py", line 76, in install
cwd=unpacked_source_directory,
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_internal\utils\subprocess.py", line 275, in runner
spinner=spinner,
File "C:\Users\ppkpp\anaconda3\envs\test\lib\site-packages\pip_internal\utils\subprocess.py", line 240, in call_subprocess
raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: 'C:\Users\ppkpp\anaconda3\envs\test\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\ppkpp\AppData\Local\Temp\pip-install-fboj3ji5\python-mecab-ko_fd1c236208bf4808a598847d74c6d986\setup.py'"'"'; file='"'"'C:\Users\ppkpp\AppData\Local\Temp\pip-install-fboj3ji5\python-mecab-ko_fd1c236208bf4808a598847d74c6d986\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\ppkpp\AppData\Local\Temp\pip-record-9zrzwsqw\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\ppkpp\anaconda3\envs\test\Include\python-mecab-ko' Check the logs for full command output.
Removed build tracker: 'C:\Users\ppkpp\AppData\Local\Temp\pip-req-tracker-7waftkab'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.