Windowsで、といってもTensorFlow自体LinuxとMacのディストリビューションしかないので仮想環境で動かすだけです。
VirtualBox, Vagrant, Gitをインストールする
VirtualBox、Vagrant、GitからWindows用インストーラーをダウンロードして普通にインストール、再起動します。
GitのsshにはPathを通しておきます。
CoreOSをVagrantで実行
Win+Rで「powershell」と入力しPowerShellを開きます。
私はMy Documents以下に「app\vagrant」を作成していますので、移動して作業します。
PS C:\Users\Tono\Documents\app\vagrant> vagrant box add https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/15.04/ubuntu-15.04-amd64.box ==> box: Box file was not detected as metadata. Adding it directly... A name is required when adding a box file directly. Please pass the `--name` parameter to `vagrant box add`. See `vagrant box add -h` for more help. PS C:\Users\Tono\Documents\app\vagrant> vagrant box add ubuntu-15 https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/15.04/ubuntu-15.04-amd64.box ==> box: Box file was not detected as metadata. Adding it directly... ==> box: Adding box 'ubuntu-15' (v0) for provider: box: Downloading: https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/15.04/ubuntu-15.04-amd64.box box: Progress: 89% (Rate: 95185/s, Estimated time remaining: 0:05:12) box: Progress: 89% (Rate: 97463/s, Estimated time box: Progress: 100% (Rate: 175k/s, Estimated time remaining: --:--:--)imated time remaining: 0:05:11) ==> box: Successfully added box 'ubuntu-15' (v0) for 'virtualbox'! PS C:\Users\Tono\Documents\app\vagrant> mkdir ubuntu ディレクトリ: C:\Users\Tono\Documents\app\vagrant Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2016/03/31 22:14 ubuntu PS C:\Users\Tono\Documents\app\vagrant> cd .\ubuntu\ PS C:\Users\Tono\Documents\app\vagrant\ubuntu> vagrant init ubuntu-15 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. PS C:\Users\Tono\Documents\app\vagrant\ubuntu> vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'ubuntu-15'... ==> default: Matching MAC address for NAT networking... ==> default: Setting the name of the VM: ubuntu_default_1459430102198_35265 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if its present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: The guest additions on this VM do not match the installed version of default: VirtualBox! In most cases this is fine, but in rare cases it can default: prevent things such as shared folders from working properly. If you see default: shared folder errors, please make sure the guest additions within the default: virtual machine match the version of VirtualBox you have installed on default: your host and reload your VM. default: default: Guest Additions Version: 4.3.22_Ubuntu r98236 default: VirtualBox Version: 5.0 ==> default: Mounting shared folders... default: /vagrant => C:/Users/Tono/Documents/app/vagrant/ubuntu Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the guest and can work properly. The command attempted was: mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant The error output from the last command was: stdin: is not a tty mount: unknown filesystem type 'vboxsf' PS C:\Users\Tono\Documents\app\vagrant\ubuntu> vagrant ssh Welcome to Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic x86_64) * Documentation: https://help.ubuntu.com/ Your Ubuntu release is not supported anymore. For upgrade information, please visit: http://www.ubuntu.com/releaseendoflife New release '15.10' available. Run 'do-release-upgrade' to upgrade to it.
ここまででUbuntuが立ち上がります。
virtualenv環境を準備する
Python関係をインストールします。
vagrant@vagrant-ubuntu-trusty:~$ sudo apt-get install python-pip python-dev python-virtualenv Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libexpat1-dev libpython-dev libpython2.7 libpython2.7-dev python-chardet python-chardet-whl python-colorama python-colorama-whl python-distlib python-distlib-whl python-html5lib python-html5lib-whl python-ndg-httpsclient python-openssl python-pip-whl python-pkg-resources python-pyasn1 python-requests python-requests-whl python-setuptools python-setuptools-whl python-six python-six-whl python-urllib3 python-urllib3-whl python-wheel python2.7-dev python3-virtualenv virtualenv Suggested packages: python-genshi python-lxml python-openssl-doc python-openssl-dbg python-distribute python-distribute-doc doc-base Recommended packages: python-dev-all The following NEW packages will be installed: libexpat1-dev libpython-dev libpython2.7 libpython2.7-dev python-chardet python-chardet-whl python-colorama python-colorama-whl python-dev python-distlib python-distlib-whl python-html5lib python-html5lib-whl python-ndg-httpsclient python-openssl python-pip python-pip-whl python-pkg-resources python-pyasn1 python-requests python-requests-whl python-setuptools python-setuptools-whl python-six python-six-whl python-urllib3 python-urllib3-whl python-virtualenv python-wheel python2.7-dev python3-virtualenv virtualenv 0 upgraded, 32 newly installed, 0 to remove and 41 not upgraded. Need to get 22.4 MB of archives. After this operation, 42.4 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://archive.ubuntu.com/ubuntu/ vivid/main libpython2.7 amd64 2.7.9-2ubuntu3 [1,080 kB] Get:2 http://archive.ubuntu.com/ubuntu/ vivid/main libexpat1-dev amd64 2.1.0-6ubuntu1 [115 kB] Get:3 http://archive.ubuntu.com/ubuntu/ vivid/main libpython2.7-dev amd64 2.7.9-2ubuntu3 [18.6 MB] Get:4 http://archive.ubuntu.com/ubuntu/ vivid/main libpython-dev amd64 2.7.9-1 [7,836 B] Get:5 http://archive.ubuntu.com/ubuntu/ vivid/main python-pkg-resources all 12.2-1 [75.6 kB] Get:6 http://archive.ubuntu.com/ubuntu/ vivid/main python-chardet all 2.3.0-1 [96.6 kB] Get:7 http://archive.ubuntu.com/ubuntu/ vivid/universe python-chardet-whl all 2.3.0-1 [170 kB] Get:8 http://archive.ubuntu.com/ubuntu/ vivid/universe python-colorama all 0.3.2-1 [20.2 kB] Get:9 http://archive.ubuntu.com/ubuntu/ vivid/universe python-colorama-whl all 0.3.2-1 [20.2 kB] Get:10 http://archive.ubuntu.com/ubuntu/ vivid/main python2.7-dev amd64 2.7.9-2ubuntu3 [270 kB] Get:11 http://archive.ubuntu.com/ubuntu/ vivid/main python-dev amd64 2.7.9-1 [1,220 B] Get:12 http://archive.ubuntu.com/ubuntu/ vivid/universe python-distlib all 0.1.9-1 [113 kB] Get:13 http://archive.ubuntu.com/ubuntu/ vivid/universe python-distlib-whl all 0.1.9-1 [141 kB] Get:14 http://archive.ubuntu.com/ubuntu/ vivid/main python-six all 1.9.0-1 [10.5 kB] Get:15 http://archive.ubuntu.com/ubuntu/ vivid/main python-html5lib all 0.999-3 [83.4 kB] Get:16 http://archive.ubuntu.com/ubuntu/ vivid/universe python-html5lib-whl all 0.999-3 [109 kB] Get:17 http://archive.ubuntu.com/ubuntu/ vivid/main python-openssl amd64 0.13.1-2ubuntu1 [81.7 kB] Get:18 http://archive.ubuntu.com/ubuntu/ vivid/main python-ndg-httpsclient all 0.3.2-1ubuntu4 [20.8 kB] Get:19 http://archive.ubuntu.com/ubuntu/ vivid/main python-urllib3 all 1.9.1-3 [49.1 kB] Get:20 http://archive.ubuntu.com/ubuntu/ vivid/main python-requests all 2.4.3-6 [193 kB] Get:21 http://archive.ubuntu.com/ubuntu/ vivid/main python-setuptools all 12.2-1 [197 kB] Get:22 http://archive.ubuntu.com/ubuntu/ vivid/universe python-pip all 1.5.6-5ubuntu2 [100 kB] Get:23 http://archive.ubuntu.com/ubuntu/ vivid/universe python-six-whl all 1.9.0-1 [12.7 kB] Get:24 http://archive.ubuntu.com/ubuntu/ vivid/universe python-urllib3-whl all 1.9.1-3 [70.6 kB] Get:25 http://archive.ubuntu.com/ubuntu/ vivid/universe python-requests-whl all 2.4.3-6 [231 kB] Get:26 http://archive.ubuntu.com/ubuntu/ vivid/universe python-setuptools-whl all 12.2-1 [204 kB] Get:27 http://archive.ubuntu.com/ubuntu/ vivid/universe python-pip-whl all 1.5.6-5ubuntu2 [112 kB] Get:28 http://archive.ubuntu.com/ubuntu/ vivid/main python-pyasn1 all 0.1.7-1ubuntu2 [44.2 kB] Get:29 http://archive.ubuntu.com/ubuntu/ vivid/universe python-virtualenv all 1.11.6+ds-1 [50.9 kB] Get:30 http://archive.ubuntu.com/ubuntu/ vivid/universe python-wheel all 0.24.0-1 [44.6 kB] Get:31 http://archive.ubuntu.com/ubuntu/ vivid/universe python3-virtualenv all 1.11.6+ds-1 [50.2 kB] Get:32 http://archive.ubuntu.com/ubuntu/ vivid/universe virtualenv all 1.11.6+ds-1 [4,396 B] Fetched 22.4 MB in 3min 31s (106 kB/s) Extracting templates from packages: 100% Selecting previously unselected package libpython2.7:amd64. (Reading database ... 60906 files and directories currently installed.) Preparing to unpack .../libpython2.7_2.7.9-2ubuntu3_amd64.deb ... Unpacking libpython2.7:amd64 (2.7.9-2ubuntu3) ... Selecting previously unselected package libexpat1-dev:amd64. Preparing to unpack .../libexpat1-dev_2.1.0-6ubuntu1_amd64.deb ... Unpacking libexpat1-dev:amd64 (2.1.0-6ubuntu1) ... Selecting previously unselected package libpython2.7-dev:amd64. Preparing to unpack .../libpython2.7-dev_2.7.9-2ubuntu3_amd64.deb ... Unpacking libpython2.7-dev:amd64 (2.7.9-2ubuntu3) ... Selecting previously unselected package libpython-dev:amd64. Preparing to unpack .../libpython-dev_2.7.9-1_amd64.deb ... Unpacking libpython-dev:amd64 (2.7.9-1) ... Selecting previously unselected package python-pkg-resources. Preparing to unpack .../python-pkg-resources_12.2-1_all.deb ... Unpacking python-pkg-resources (12.2-1) ... Selecting previously unselected package python-chardet. Preparing to unpack .../python-chardet_2.3.0-1_all.deb ... Unpacking python-chardet (2.3.0-1) ... Selecting previously unselected package python-chardet-whl. Preparing to unpack .../python-chardet-whl_2.3.0-1_all.deb ... Unpacking python-chardet-whl (2.3.0-1) ... Selecting previously unselected package python-colorama. Preparing to unpack .../python-colorama_0.3.2-1_all.deb ... Unpacking python-colorama (0.3.2-1) ... Selecting previously unselected package python-colorama-whl. Preparing to unpack .../python-colorama-whl_0.3.2-1_all.deb ... Unpacking python-colorama-whl (0.3.2-1) ... Selecting previously unselected package python2.7-dev. Preparing to unpack .../python2.7-dev_2.7.9-2ubuntu3_amd64.deb ... Unpacking python2.7-dev (2.7.9-2ubuntu3) ... Selecting previously unselected package python-dev. Preparing to unpack .../python-dev_2.7.9-1_amd64.deb ... Unpacking python-dev (2.7.9-1) ... Selecting previously unselected package python-distlib. Preparing to unpack .../python-distlib_0.1.9-1_all.deb ... Unpacking python-distlib (0.1.9-1) ... Selecting previously unselected package python-distlib-whl. Preparing to unpack .../python-distlib-whl_0.1.9-1_all.deb ... Unpacking python-distlib-whl (0.1.9-1) ... Selecting previously unselected package python-six. Preparing to unpack .../python-six_1.9.0-1_all.deb ... Unpacking python-six (1.9.0-1) ... Selecting previously unselected package python-html5lib. Preparing to unpack .../python-html5lib_0.999-3_all.deb ... Unpacking python-html5lib (0.999-3) ... Selecting previously unselected package python-html5lib-whl. Preparing to unpack .../python-html5lib-whl_0.999-3_all.deb ... Unpacking python-html5lib-whl (0.999-3) ... Selecting previously unselected package python-openssl. Preparing to unpack .../python-openssl_0.13.1-2ubuntu1_amd64.deb ... Unpacking python-openssl (0.13.1-2ubuntu1) ... Selecting previously unselected package python-ndg-httpsclient. Preparing to unpack .../python-ndg-httpsclient_0.3.2-1ubuntu4_all.deb ... Unpacking python-ndg-httpsclient (0.3.2-1ubuntu4) ... Selecting previously unselected package python-urllib3. Preparing to unpack .../python-urllib3_1.9.1-3_all.deb ... Unpacking python-urllib3 (1.9.1-3) ... Selecting previously unselected package python-requests. Preparing to unpack .../python-requests_2.4.3-6_all.deb ... Unpacking python-requests (2.4.3-6) ... Selecting previously unselected package python-setuptools. Preparing to unpack .../python-setuptools_12.2-1_all.deb ... Unpacking python-setuptools (12.2-1) ... Selecting previously unselected package python-pip. Preparing to unpack .../python-pip_1.5.6-5ubuntu2_all.deb ... Unpacking python-pip (1.5.6-5ubuntu2) ... Selecting previously unselected package python-six-whl. Preparing to unpack .../python-six-whl_1.9.0-1_all.deb ... Unpacking python-six-whl (1.9.0-1) ... Selecting previously unselected package python-urllib3-whl. Preparing to unpack .../python-urllib3-whl_1.9.1-3_all.deb ... Unpacking python-urllib3-whl (1.9.1-3) ... Selecting previously unselected package python-requests-whl. Preparing to unpack .../python-requests-whl_2.4.3-6_all.deb ... Unpacking python-requests-whl (2.4.3-6) ... Selecting previously unselected package python-setuptools-whl. Preparing to unpack .../python-setuptools-whl_12.2-1_all.deb ... Unpacking python-setuptools-whl (12.2-1) ... Selecting previously unselected package python-pip-whl. Preparing to unpack .../python-pip-whl_1.5.6-5ubuntu2_all.deb ... Unpacking python-pip-whl (1.5.6-5ubuntu2) ... Selecting previously unselected package python-pyasn1. Preparing to unpack .../python-pyasn1_0.1.7-1ubuntu2_all.deb ... Unpacking python-pyasn1 (0.1.7-1ubuntu2) ... Selecting previously unselected package python-virtualenv. Preparing to unpack .../python-virtualenv_1.11.6+ds-1_all.deb ... Unpacking python-virtualenv (1.11.6+ds-1) ... Selecting previously unselected package python-wheel. Preparing to unpack .../python-wheel_0.24.0-1_all.deb ... Unpacking python-wheel (0.24.0-1) ... Selecting previously unselected package python3-virtualenv. Preparing to unpack .../python3-virtualenv_1.11.6+ds-1_all.deb ... Unpacking python3-virtualenv (1.11.6+ds-1) ... Selecting previously unselected package virtualenv. Preparing to unpack .../virtualenv_1.11.6+ds-1_all.deb ... Unpacking virtualenv (1.11.6+ds-1) ... Processing triggers for man-db (2.7.0.2-5) ... Setting up libpython2.7:amd64 (2.7.9-2ubuntu3) ... Setting up libexpat1-dev:amd64 (2.1.0-6ubuntu1) ... Setting up libpython2.7-dev:amd64 (2.7.9-2ubuntu3) ... Setting up libpython-dev:amd64 (2.7.9-1) ... Setting up python-pkg-resources (12.2-1) ... Setting up python-chardet (2.3.0-1) ... Setting up python-chardet-whl (2.3.0-1) ... Setting up python-colorama (0.3.2-1) ... Setting up python-colorama-whl (0.3.2-1) ... Setting up python2.7-dev (2.7.9-2ubuntu3) ... Setting up python-dev (2.7.9-1) ... Setting up python-distlib (0.1.9-1) ... Setting up python-distlib-whl (0.1.9-1) ... Setting up python-six (1.9.0-1) ... Setting up python-html5lib (0.999-3) ... Setting up python-html5lib-whl (0.999-3) ... Setting up python-openssl (0.13.1-2ubuntu1) ... Setting up python-ndg-httpsclient (0.3.2-1ubuntu4) ... Setting up python-urllib3 (1.9.1-3) ... Setting up python-requests (2.4.3-6) ... Setting up python-setuptools (12.2-1) ... Setting up python-pip (1.5.6-5ubuntu2) ... Setting up python-six-whl (1.9.0-1) ... Setting up python-urllib3-whl (1.9.1-3) ... Setting up python-requests-whl (2.4.3-6) ... Setting up python-setuptools-whl (12.2-1) ... Setting up python-pip-whl (1.5.6-5ubuntu2) ... Setting up python-pyasn1 (0.1.7-1ubuntu2) ... Setting up python-virtualenv (1.11.6+ds-1) ... Setting up python-wheel (0.24.0-1) ... Setting up python3-virtualenv (1.11.6+ds-1) ... Setting up virtualenv (1.11.6+ds-1) ... Processing triggers for libc-bin (2.21-0ubuntu4) ...
TensorFlowのインストール
vagrant@vagrant-ubuntu-trusty:~$ virtualenv --system-site-packages ~/tensorflow vagrant@vagrant-ubuntu-trusty:~$ source ~/tensorflow/bin/activate (tensorflow)vagrant@vagrant-ubuntu-trusty:~$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl (以降TensorFlowの長いログ)
テストの実行
(tensorflow)vagrant@vagrant-ubuntu-trusty:~$ python Python 2.7.9 (default, Apr 2 2015, 15:33:21) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow!') >>> sess = tf.Session() >>> print(sess.run(hello)) Hello, TensorFlow!
普通に動きました。
コメントを残す