jonghwanhyeon / python-mecab-ko

A python binding for mecab-ko

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

harmlessman opened this issue · comments

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.

죄송하지만 현재까지는 Windows 환경을 지원할 계획이 없습니다. 만약 Windows 10 이상을 사용하고 계시다면, Windows Subsystem for Linux를 사용하시는 것을 추천 드립니다.