-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
executable file
·41 lines (32 loc) · 1.43 KB
/
install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import io
import shlex
import subprocess
from os.path import dirname, abspath
from root import check_valid_sys_requirements
python_libraries = ['tensorflow==1.10', 'netifaces', 'deepspeech', 'webrtcvad', 'halo', 'pyaudio', 'opencv-python',
'face_recognition', 'SpeechRecognition', 'tflearn', 'beautifulsoup', 'imutils', 'spacy', 'nltk',
'snowboy', 'beautifulsoup4', 'sklearn', 'requests', 'pyttsx3', 'pyobjc', 'uvloop', 'dlib',
'html5lib']
homebrew_formulas = ['cmake', 'portaudio', 'sox', 'swig']
def reader(buffer, title=None):
print(f'{title}: ', ' '.join((io.TextIOWrapper(buffer.stderr, encoding='utf-8'))))
return
def executor(app, pkg=None):
commands = {
'brew': f'brew install {pkg}',
'brew update': 'brew update',
'python': f'pip install {pkg}',
'spacy': 'python -m spacy download en_core_web_lg'
}
command_line = commands.get(app, None)
command = shlex.split(command_line)
reader(subprocess.Popen(command, stderr=subprocess.PIPE, cwd=dirname(abspath(__file__))), app)
return
if __name__ == '__main__':
check_valid_sys_requirements()
print('Installing dependencies for Krystal. Please do not interrupt.')
executor('brew update')
for x in homebrew_formulas: executor('brew', x)
for x in python_libraries: executor('python', x)
executor('spacy')
print('Complete. You can now start Krystal.')