Mycroft-core: ์„ค์น˜ ํ”„๋กœ๊ทธ๋žจ Python ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค. -- '_ctypes'๋ผ๋Š” ๋ชจ๋“ˆ์ด ์—†์Šต๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2019๋…„ 02์›” 03์ผ  ยท  10์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: MycroftAI/mycroft-core

./dev_setup.sh

Processing triggers for sgml-base (1.29) ...
Setting up docbook-xml (4.5-8) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for systemd (232-25+deb9u8) ...
Processing triggers for sgml-base (1.29) ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1603k  100 1603k    0     0  1816k      0 --:--:-- --:--:-- --:--:-- 1816k
Traceback (most recent call last):
  File "<stdin>", line 20649, in <module>
  File "<stdin>", line 197, in main
  File "<stdin>", line 82, in bootstrap
  File "/tmp/tmplfnx9iya/pip.zip/pip/_internal/__init__.py", line 42, in <module>
  File "/tmp/tmplfnx9iya/pip.zip/pip/_internal/cmdoptions.py", line 16, in <module>
  File "/tmp/tmplfnx9iya/pip.zip/pip/_internal/index.py", line 25, in <module>
  File "/tmp/tmplfnx9iya/pip.zip/pip/_internal/download.py", line 39, in <module>
  File "/tmp/tmplfnx9iya/pip.zip/pip/_internal/utils/glibc.py", line 3, in <module>
  File "/usr/local/lib/python3.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Failed to set up virtualenv for mycroft, exiting setup.

๋ผ์ฆˆ๋น„์•ˆ ์„ค์น˜.

"sgml-base์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ ํŠธ๋ฆฌ๊ฑฐ"๊ฐ€ ๋‘ ๋ฒˆ ๋‚˜์—ด๋œ๋‹ค๋Š” ์ ๋„ ํฅ๋ฏธ๋กญ์Šต๋‹ˆ๋‹ค. ์ด์ƒํ•œ?

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

์—ฌ๊ธฐ ์—์„œ ๋‹ต์„ ์ฐพ์•˜ yum install libffi-dev ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋ชจ๋“  10 ๋Œ“๊ธ€

์—ฌ๊ธฐ์—์„œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด๊ฒƒ์€ ์—ฌ์ „ํžˆ โ€‹โ€‹๋ฒ„๊ทธ์ž…๋‹ˆ๋‹ค.
https://stackoverflow.com/questions/27022373/python3-importerror-no-module-named-ctypes-when-using-value-from-module-mul

Raspbian์—์„œ๋Š” ์„ค์น˜ ์Šคํฌ๋ฆฝํŠธ์— ๋‹ค์Œ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Git์€ ์ด๋ฏธ ์„ค์น˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ git์„ ํ†ตํ•ด 'mycroft-core' ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด์˜ 'cpython' ํ•˜์œ„ ๋””๋ ‰ํ† ๋ฆฌ์— git repo๋ฅผ ๋‹ค์šด๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.

git clone https://github.com/python/cpython.git

๊ทธ๋ฆฌ๊ณ  ๊ทธ๊ฒƒ์„ ๋นŒ๋“œํ•˜๊ณ  ์ปดํŒŒ์ผํ•˜์‹ญ์‹œ์˜ค:

cd cpython

./configure
make -j 4
sudo make altinstall

cd ..

git์ด ์„ค์น˜๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ(์ด ์Šคํฌ๋ฆฝํŠธ๋Š” ๋ชจ๋“  Linux์—์„œ ์‹คํ–‰๋˜๋ฏ€๋กœ) git clone ์ „์— ๋‹ค์Œ์„ ๊ณ ๋ คํ•˜์‹ญ์‹œ์˜ค.
์†Œ์Šค์—์„œ ์„ค์น˜:
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

์ƒˆ๋กœ์šด ๋ฌธ์ œ:

cpython ์ปดํŒŒ์ผํ•˜๊ณ  ์„ค์น˜ํ•œ ํ›„ start-mycroft.sh ์Šคํฌ๋ฆฝํŠธ๋Š” ์—ฌ์ „ํžˆ ์‹คํŒจํ•˜์ง€๋งŒ ์‹คํŒจํ•œ ํ›„์—๋„ ๊ณ„์†๋ฉ๋‹ˆ๋‹ค.

Traceback (most recent call last):
  File "<stdin>", line 20649, in <module>
  File "<stdin>", line 197, in main
  File "<stdin>", line 82, in bootstrap
  File "/tmp/tmpy509z2ho/pip.zip/pip/_internal/__init__.py", line 42, in <module>
  File "/tmp/tmpy509z2ho/pip.zip/pip/_internal/cmdoptions.py", line 16, in <module>
  File "/tmp/tmpy509z2ho/pip.zip/pip/_internal/index.py", line 25, in <module>
  File "/tmp/tmpy509z2ho/pip.zip/pip/_internal/download.py", line 39, in <module>
  File "/tmp/tmpy509z2ho/pip.zip/pip/_internal/utils/glibc.py", line 3, in <module>
  File "/usr/local/lib/python3.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Failed to set up virtualenv for mycroft, exiting setup.
start-mycroft.sh:  Mycroft command/service launcher
usage: start-mycroft.sh [COMMAND] [restart] [params]

Services COMMANDs:
  all                      runs core services: bus, audio, skills, voice
  debug                    runs core services, then starts the CLI
  audio                    the audio playback service
  bus                      the messagebus service
  skills                   the skill service
  voice                    voice capture service
  enclosure                mark_1 enclosure service

Tool COMMANDs:
  cli                      the Command Line Interface
  unittest                 run mycroft-core unit tests (requires pytest)
  skillstest               run the skill autotests for all skills (requires pytest)

Util COMMANDs:
  audiotest                attempt simple audio validation
  audioaccuracytest        more complex audio validation
  sdkdoc                   generate sdk documentation

Options:
  restart                  (optional) Force the service to restart if running

Examples:
  start-mycroft.sh all
  start-mycroft.sh all restart
  start-mycroft.sh cli
  start-mycroft.sh unittest

์‹คํŒจํ•œ ํ›„ ์„ค์น˜๋œ ๊ฒƒ์ฒ˜๋Ÿผ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

./start-mycroft.sh debug ๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๊ณ  ํ•˜๋ฉด ์—ฌ๋Ÿฌ ์˜ค๋ฅ˜์™€ ํ•จ๊ป˜ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค.

ModuleNotFoundError: No module named '_ctypes'
Failed to set up virtualenv for mycroft, exiting setup.
Starting all mycroft-core services
Initializing...
Starting background service bus
CAUTION: The Mycroft bus is an open websocket with no built-in security
         measures.  You are responsible for protecting the local port
         8181 with a firewall as appropriate.
./start-mycroft.sh: line 140: /var/log/mycroft/bus.log: No such file or directory
Starting background service skills
./start-mycroft.sh: line 140: /var/log/mycroft/skills.log: No such file or directory
Starting background service audio
./start-mycroft.sh: line 140: /var/log/mycroft/audio.log: No such file or directory
Starting background service voice
./start-mycroft.sh: line 140: /var/log/mycroft/voice.log: No such file or directory
Starting background service enclosure
./start-mycroft.sh: line 140: /var/log/mycroft/enclosure.log: No such file or directory
Starting cli
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/home/pi/Mycroft/mycroft-core/mycroft/__init__.py", line 17, in <module>
    from mycroft.api import Api
  File "/home/pi/Mycroft/mycroft-core/mycroft/api/__init__.py", line 18, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

picroft๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜๋ฉด ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

      Guessing you're not using picroft, which just works.

์˜ณ์€. GUI ํ™˜๊ฒฝ์—์„œ ๋‚ด Rpi๋กœ ๋‹ค๋ฅธ ์ž‘์—…์„ ํ•˜๋Š” ๊ฒƒ๋„ ์ข‹์•„ํ•˜๊ณ  Picroft๊ฐ€ ์ œ๋Œ€๋กœ ์‹คํ–‰๋˜์ง€ ์•Š๊ณ  ๊ธฐ๋ณธ USB ๋งˆ์ดํฌ๋ฅผ ๊ฐ์ง€ํ•˜์ง€ ๋ชปํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. GUI ์—†์ด ๋ฒ„๊ทธ๋ฅผ ๋ณด๊ณ ํ•  ์ˆ˜ ์—†์Œ

์ด๊ฒƒ์€ ์ •๋ง ์ด์ƒํ•œ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. ์žฅ์น˜์˜ Python ํ™˜๊ฒฝ์ด ์ œ๋Œ€๋กœ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๊นŒ? _ctypes๋Š” mycroft virtualenv๋ฅผ ๋งŒ๋“œ๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๋กœ์ปฌ python ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

mycroft-core ๋””๋ ‰ํ† ๋ฆฌ rm -rf .venv ์—์„œ .venv ํด๋”๋ฅผ ์‚ญ์ œํ•œ ๋‹ค์Œ dev_setup.sh ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋‹ค์‹œ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

์•ˆ๋…•ํ•˜์„ธ์š”, ์ด ๋ฌธ์ œ์— ๋Œ€ํ•ด 4๊ฐœ์›” ๋™์•ˆ ์—ฐ๋ฝ์ด ์—†์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ข…๋ฃŒํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ด ๋ฌธ์ œ๊ฐ€ ๊ณ„์† ๋ฐœ์ƒํ•˜๋ฉด ๋ฌธ์ œ๋ฅผ ๋‹ค์‹œ ์—ฌ์‹ญ์‹œ์˜ค.

์—ฌ๊ธฐ ์—์„œ ๋‹ต์„ ์ฐพ์•˜ yum install libffi-dev ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

์—ฌ๊ธฐ ์—์„œ ๋‹ต์„ ์ฐพ์•˜ yum install libffi-dev ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ, ์ €์—๊ฒŒ ํšจ๊ณผ์ ์ด์—ˆ์Šต๋‹ˆ๋‹ค. Centos 7์— ๋‹ค์Œ ํŒจํ‚ค์ง€๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

sudo yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel libffi-dev gcc gcc-c++ zlib libffi-devel

๊ทธ๋Ÿฐ ๋‹ค์Œ Python 3.8.1์„ ๋‹ค์‹œ ์„ค์น˜ํ–ˆ์Šต๋‹ˆ๋‹ค.

wget http://python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz

tar xf Python-3.6.8.tar.xz

cd Python-3.6.8

./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"

make && make altinstall

๊ทธ๋Ÿฐ ๋‹ค์Œ ๋งˆ์นจ๋‚ด docker-compose๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

pip3.8 install docker-compose

@grosshen ๊ฐ์‚ฌ

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰