よしたかのぶろぐ

大学院生の戯言

最初の備忘録

today’s trouble

備忘録,めちゃめちゃ大事だなと今更気付きましたこんにちわ.

コンピュータサイエンスにおける知能系の研究が本分,新しいもの好きな性格から中途半端にサービスを利用しては飽きの繰り返しをしがちな東北の田舎で大学院生を生業とする者です.
初めて備忘録ブログ始めたわけですが,ブログ自体は高校生から,アメブロ→zozo→tumblr→hatenaという編纂で季節のようにネット上を移りゆく.というかそもそも備忘録なのにこんな自己紹介いるのって感じ.
追々備忘録などという形式に慣れていくつもりです,どうぞお手柔らかに.

cannot use pip3

よくpythonっていう蛇さんがロゴに可愛いくてライブラリが豊富でバズるプログラミング言語を研究で利用するのですが,生きた化石のように

➜  notebooks git:(master) ✗ python -V
Python 2.7.11 :: Continuum Analytics, Inc.

で頑張っていました.こないだ後輩にバカにされました.アップグレードしました.minicondaで管理しています.

➜  notebooks git:(master) ✗ python3 -V
Python 3.5.2

3系にしてから半年経った12月.知識処理特論という授業の課題でコーパスの文字種に対するエントロピーやバイト数を求めることになりました.開発環境はipython notebookです.起動しよう.

➜  notebooks git:(master) ✗ ipython3 notebook
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
Traceback (most recent call last):
  File "/usr/local/bin/ipython3", line 11, in <module>
    sys.exit(start_ipython())
  File "/usr/local/lib/python3.5/site-packages/IPython/__init__.py", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-109>", line 2, in initialize
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/IPython/terminal/ipapp.py", line 300, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/IPython/core/application.py", line 446, in initialize
    self.parse_command_line(argv)
  File "/usr/local/lib/python3.5/site-packages/IPython/terminal/ipapp.py", line 295, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<decorator-gen-4>", line 2, in parse_command_line
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 514, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "/usr/local/lib/python3.5/site-packages/IPython/core/application.py", line 236, in initialize_subcommand
    return super(BaseIPythonApplication, self).initialize_subcommand(subc, argv)
  File "<decorator-gen-3>", line 2, in initialize_subcommand
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/traitlets/config/application.py", line 445, in initialize_subcommand
    subapp = import_item(subapp)
  File "/usr/local/lib/python3.5/site-packages/ipython_genutils/importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
ImportError: No module named 'notebook'

!???????????

どうやら3系にあげてから僕はpythonと仲良くなれてなかったみたい.まだ生きた化石だった.
というわけでリファレンスあさりスタート.
以下を参照します.
pipコマンドでPython2、pip3コマンドでPython3が使われるようにしたい-stackoverflow

https://github.com/yyuu/pyenv#installation

➜  notebooks git:(master) ✗ pip install --upgrade pip
equirement already up-to-date: pip in /Users/yoshidatakayuki/miniconda2/lib/python2.7/site-packages

続いて,i wanna install pip3.

“➜  notebooks git:(master) ✗ pip3 -V
pip 8.1.2 from /usr/local/lib/python3.5/site-packages (python 3.5)”

……installed

next,i try to run “pip3”

(➜pip3 install requests)
.
.
.
   100% |████████████████████████████████| 583kB 549kB/s
Installing collected packages: requests
Successfully installed requests-2.12.3
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
➜  notebooks git:(master) ✗

whats ‘pip install –upgrade pip’ ?

➜  notebooks git:(master) ✗ pip install --upgrade pip
Requirement already up-to-date: pip in /Users/yoshidatakayuki/miniconda2/lib/python2.7/site-packages

……ignore,haha
一旦こちらも無視します.

pip3’s libraryを確認します.

➜  notebooks git:(master) ✗ pip3 list
appnope (0.1.0)
decorator (4.0.10)
ipython (5.1.0)
ipython-genutils (0.1.0)
Jinja2 (2.8)
MarkupSafe (0.23)
numpy (1.11.2)
pexpect (4.2.1)
pickleshare (0.7.4)
pip (8.1.2)
prompt-toolkit (1.0.9)
ptyprocess (0.5.1)
Pygments (2.1.3)
pyzmq (16.0.2)
requests (2.12.3)
setuptools (28.7.1)
simplegeneric (0.8.1)
six (1.10.0)
tornado (4.4.2)
traitlets (4.3.1)
wcwidth (0.1.7)
wheel (0.29.0)
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

oh,there not exist ipython!
続いて以下のブログを参照しました.
nsbioの備忘録

“you must install jupyter when cannot run ‘ipython notebook’.”

stack overflow says same message.

“  notebooks git:(master) ✗ ipython3 notebook
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
[I 13:11:56.681 NotebookApp] Serving notebooks from local directory: /Users/yoshidatakayuki/gitrepository/workspace/notebooks
[I 13:11:56.681 NotebookApp] 0 active kernels
.
.
.
.
”

ふぅ…無理やり感でなんとか復旧….
はてなで備忘録の書き方も覚えて行こう!