Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install . 오류 #59

Closed
haha23h opened this issue Apr 15, 2019 · 3 comments
Closed

pip install . 오류 #59

haha23h opened this issue Apr 15, 2019 · 3 comments
Assignees
Milestone

Comments

@haha23h
Copy link

haha23h commented Apr 15, 2019

Processing /data/khaiii/build/package_python
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-req-build-oaZYzh/setup.py", line 45
with zipfile.ZipFile(f'{_SRC_NAME}.zip', 'r') as src_zip:
^
SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-oaZYzh/

@krikit
Copy link
Member

krikit commented Apr 15, 2019

pip install . 명령을 실행하실 때 python 환경의 버전이 낮은 것 같습니다.
코드의 f'{_SRC_NAME}.zip'이 부분에 f-strings literal을 사용했는데 이 때문이 아닐까 생각합니다.
이는 Python 3.6 이상에서만 적용되는 문법으로 예전에 호환성을 위해 수정한 적이 있는데 미처 덜 수정한 부분입니다.

해결책으로는

  1. Python 버전 3.6 이상의 환경에서 하시면 해결될 듯 합니다.
  2. 여의치 않다면 아래와 같이 setup.py 코드를 임시로 수정하면 될 듯 합니다.

from:

        with zipfile.ZipFile(f'{_SRC_NAME}.zip', 'r') as src_zip:
            src_zip.extractall()
        build_dir = f'{_SRC_NAME}/build'
        os.makedirs(build_dir, exist_ok=True)
        subprocess.check_call('cmake ..', cwd=build_dir, shell=True)
        subprocess.check_call('make all resource', cwd=build_dir, shell=True)
        shutil.rmtree('khaiii/lib', ignore_errors=True)
        shutil.copytree(f'{build_dir}/lib', 'khaiii/lib')
        shutil.rmtree('khaiii/share', ignore_errors=True)
        shutil.copytree(f'{build_dir}/share', 'khaiii/share')

to:

        with zipfile.ZipFile('{}.zip'.format(_SRC_NAME), 'r') as src_zip:
            src_zip.extractall()
        build_dir = '{}/build'.format(_SRC_NAME)
        os.makedirs(build_dir, exist_ok=True)
        subprocess.check_call('cmake ..', cwd=build_dir, shell=True)
        subprocess.check_call('make all resource', cwd=build_dir, shell=True)
        shutil.rmtree('khaiii/lib', ignore_errors=True)
        shutil.copytree('{}/lib'.format(build_dir), 'khaiii/lib')
        shutil.rmtree('khaiii/share', ignore_errors=True)
        shutil.copytree('{}/share'.format(build_dir), 'khaiii/share')

@krikit krikit self-assigned this Apr 16, 2019
@krikit krikit added this to the 0.4 milestone Apr 16, 2019
@haha23h
Copy link
Author

haha23h commented Apr 16, 2019

버전 업그레이드로 해결했습니다.
감사합니다~

@haha23h haha23h closed this as completed Apr 18, 2019
@krikit
Copy link
Member

krikit commented Apr 18, 2019

Python 3.6 버전 아래에서 설치 스크립트 오류가 나는 부분을 수정하기 위해 (f-strings 관련) 이슈를 열어둡니다.

@krikit krikit reopened this Apr 18, 2019
hubert-lee added a commit that referenced this issue Jun 5, 2019
f-strings로 인해 python 3.6 버전 이하에서 오류가 나는 부분 수정 #59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants