yotta がインストール(アップデート)できない場合の対処方法(OS X)
OS X版で yotta をアップデートしようとしたのですが、以下のようなエラーが出て、インストールできませんでした。
$ sudo pip install yotta
# snip
Requirement already satisfied (use --upgrade to upgrade): Cython in /Library/Python/2.7/site-packages (from hidapi->pyOCD<1.0,>=0.3->valinor<1.0,>=0.0.0->yotta)
Installing collected packages: setuptools, enum34, ipaddress, idna, pycparser, cffi, cryptography, PyJWT, pathlib, functools32, jsonschema, argcomplete, mbed-test-wrapper, pyyaml, intelhex, hidapi, pyOCD, argparse, xmltodict, project-generator-definitions, project-generator, pyelftools, valinor, jsonpointer, yotta
Found existing installation: setuptools 1.1.6
Uninstalling setuptools-1.1.6:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_set.py", line 726, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 746, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
copytree(src, real_dst, symlinks=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
raise Error, errors
setuptools を pip と共に削除して、再インストールしても駄目。
ここを読むと、pip install -U --no-deps yotta
すべしと書いてあるので、その通りにします。
Toyos-MBP13:test toyowata$ sudo pip install -U --no-deps yotta
The directory '/Users/toyowata/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/toyowata/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting yotta
Downloading yotta-0.15.0.tar.gz (126kB)
100% |████████████████████████████████| 133kB 1.4MB/s
Installing collected packages: yotta
Running setup.py install for yotta ... done
Successfully installed yotta-0.15.0
お?行けた?
Toyos-MBP13:test toyowata$ yotta
Fatal Exception, yotta=unknown
Traceback (most recent call last):
File "/usr/local/bin/yotta", line 3, in <module>
import yotta
File "/Library/Python/2.7/site-packages/yotta/__init__.py", line 6, in <module>
from yotta.main import main
File "/Library/Python/2.7/site-packages/yotta/main.py", line 11, in <module>
import argcomplete
ImportError: No module named argcomplete
まだ怒られるので、追加インストール。
Toyos-MBP13:test toyowata$ sudo pip install argcomplete
The directory '/Users/toyowata/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/toyowata/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting argcomplete
Downloading argcomplete-1.1.0-py2.py3-none-any.whl
Installing collected packages: argcomplete
Successfully installed argcomplete-1.1.0
今度はどうだろ?
Toyos-MBP13:test toyowata$ yotta
usage: yotta [-h] [--version] [-v] [--plain] [--noninteractive] [-t TARGET]
[--config path/to/config.json]
<subcommand> ...
yotta: error: too few arguments
Toyos-MBP13:test toyowata$ yotta --version
0.15.0
無事にインストールできました。
yotta 実行時に「モジュールが足りない」と怒られますが、手動で pip install
しましょう。setuptools 関連のエラーが出たときには、--no-deps
オプションでインストールします。幾つかのモジュールを追加でインストールすれば、無事に実行できるようになりました。