MacでTensorflow

Tensorflow

http://qiita.com/icoxfog417/items/fb5c24e35a849f8e2c5d
おもしろそう

インストール

https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html#pip-installation をコピペしながら作業

easy_install なんてあるの知らなくて戸惑った

<br />
sudo easy_install pip<br />
sudo easy_install --upgrade six<br />

を見逃してたので tensorflow-0.9.0-py2-none-any.whl is not a supported wheel on this platform. と言われてしまった…

sudo pip install --upgrade $TF_BINARY_URL

<br />
$ sudo pip install --upgrade $TF_BINARY_URL</p>
<p>...</p>
<p>Exception:<br />
Traceback (most recent call last):<br />
  File &quot;/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py&quot;, line 215, in main<br />
    status = self.run(options, args)<br />
  File &quot;/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py&quot;, line 317, in run<br />
    prefix=options.prefix_path,<br />
  File &quot;/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py&quot;, line 736, in install<br />
    requirement.uninstall(auto_confirm=True)<br />
  File &quot;/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py&quot;, line 742, in uninstall<br />
    paths_to_remove.remove(auto_confirm)<br />
  File &quot;/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_uninstall.py&quot;, line 115, in remove<br />
    renames(path, new_path)<br />
  File &quot;/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py&quot;, line 267, in renames<br />
    shutil.move(old, new)<br />
  File &quot;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py&quot;, line 299, in move<br />
    copytree(src, real_dst, symlinks=True)<br />
  File &quot;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py&quot;, line 208, in copytree<br />
    raise Error, errors<br />
Error: [(&#039;/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py&#039;, &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py&#039;, &quot;[Errno 1] Operation not permitted: &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py&#039;&quot;), (&#039;/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc&#039;, &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc&#039;, &quot;[Errno 1] Operation not permitted: &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc&#039;&quot;), (&#039;/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py&#039;, &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py&#039;, &quot;[Errno 1] Operation not permitted: &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py&#039;&quot;), (&#039;/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc&#039;, &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc&#039;, &quot;[Errno 1] Operation not permitted: &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc&#039;&quot;), (&#039;/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib&#039;, &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib&#039;, &quot;[Errno 1] Operation not permitted: &#039;/tmp/pip-Qy6Cic-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib&#039;&quot;)]<br />

(#^ω^)

--ignore-installed six

https://github.com/tensorflow/tensorflow/issues/500

<br />
sudo pip install --upgrade $TF_BINARY_URL --ignore-installed six<br />

でうまくいった(幻想)

ふるい numpy

<br />
$ python<br />
Python 2.7.10 (default, Oct 23 2015, 19:19:21)<br />
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin<br />
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br />
&gt;&gt;&gt; import tensorflow<br />
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9<br />
Traceback (most recent call last):<br />
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br />
  File &quot;/Library/Python/2.7/site-packages/tensorflow/__init__.py&quot;, line 23, in &lt;module&gt;<br />
    from tensorflow.python import *<br />
  File &quot;/Library/Python/2.7/site-packages/tensorflow/python/__init__.py&quot;, line 48, in &lt;module&gt;<br />
    from tensorflow.python import pywrap_tensorflow<br />
  File &quot;/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py&quot;, line 28, in &lt;module&gt;<br />
    _pywrap_tensorflow = swig_import_helper()<br />
  File &quot;/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py&quot;, line 24, in swig_import_helper<br />
    _mod = imp.load_module(&#039;_pywrap_tensorflow&#039;, fp, pathname, description)<br />
ImportError: numpy.core.multiarray failed to import<br />

(#^ω^)

Homebrew 先生

http://stackoverflow.com/questions/33859531/runtimeerror-module-compiled-against-api-version-a-but-this-version-of-numpy-is

<br />
brew install python<br />

でできた!

Posted on