pip installでエラー
pip installを叩くとこんなエラー。
$ pip install google-cloud-storage (中略) ERROR: Command errored out with exit status 1: command: /home/hoge/.pyenv/versions/3.6.3/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zj7auxa2/googleapis-common-protos/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zj7auxa2/googleapis-common-protos/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-zj7auxa2/googleapis-common-protos/pip-egg-info cwd: /tmp/pip-install-zj7auxa2/googleapis-common-protos/ Complete output (21 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/setuptools/__init__.py", line 10, in <module> from setuptools.extern.six.moves import filter, filterfalse, map File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/setuptools/extern/__init__.py", line 1, in <module> from pkg_resources.extern import VendorImporter File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3017, in <module> @_call_aside File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside f(*args, **kwargs) File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3045, in _initialize_master_working_set dist.activate(replace=False) File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2577, in activate declare_namespace(pkg) File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2151, in declare_namespace _handle_ns(packageName, path_item) File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2091, in _handle_ns _rebuild_mod_path(path, packageName, module) File "/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2120, in _rebuild_mod_path orig_path.sort(key=position_in_sys_path) AttributeError: '_NamespacePath' object has no attribute 'sort' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ||< エラーがでているファイル/home/hoge/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pkg_resources/__init__.pyの該当場所をみるとこんな。 >|| orig_path.sort(key=position_in_sys_path) module.__path__[:] = [_normalize_cached(p) for p in orig_path]
エラーメッセージと、ソースでぐぐるとstackoverflow
stackoverflow.com
で同じ現象が報告されていました。
上記 2120行目〜2021行目をコメントアウトして、
以下三行を追記。
#orig_path.sort(key=position_in_sys_path) #module.__path__[:] = [_normalize_cached(p) for p in orig_path] orig_path_t = list(orig_path) orig_path_t.sort(key=position_in_sys_path) module.__path__[:] = [_normalize_cached(p) for p in orig_path_t]
なんだろ。orig_pathがリスト型じゃないとかそんなかな。
価格:4,070円 |