[[labs.beatcraft.com]]~
[[OS X]]~
#contents
*Installing NuPIC on OS X Mavericks [#u488f455]
** Overview [#t24bb3b1]
>
This article briefly explains what NuPIC is and shows how to install NuPIC on OS X Mavericks.~
~
NuPIC is an algorithm for machine learning, based upon CLA/HTM Theory. This is developed by Numenta. This is not the newest version of Numenta's machine learning algorithm, but this is freely available at GitHub.~
~
More information and a copy of NuPIC are available at [[NuPIC WiKi>https://github.com/numenta/nupic/wiki]]~
~
For details of how to install and how to execute NuPIC on OS X Mavericks, please visit the article at GitHub:[[Running NuPIC on OS X>https://github.com/numenta/nupic/wiki/Running-NuPIC-on-OS-X]].~

** Requirements [#w7ac60e7]
>
- Python 2.7.5 (for this article)
-- pip 1.5.4
~
- OS X 10.9 Mavericks or later~
This a must-requirement. If you use older version of OS X, please update it.~
~
- Xcode 5 or later (including its Command Line Tools)
Please download Command Line Tools from Xcode. Command Line Tools include software packages, which are necessary for installing NuPIC.~
-- clang
-- Git (This is a part of Xcode)
-- Python (This is installed with Xcode, Xcode's Command Line Tools)
-- GCC or Clang (This is a part of Xcode, Xcode's Command Line Tools)
~
- homebrew 0.95
To use homebrew 0.95, please install the software packages shown below.
-- CMake (Needed to be installed separately as well as independently)
-- autoconf
-- automake
-- libtool

* Instructions for building NuPIC [#a6e903fa]
>
1. Checking OS~
The minimum version of OS X is 10.9. If you are using older than OS X 10.9 Mavericks, please update your OS X. This article uses OS X 10.9.2.~

>
2 Setting up Build Tools~
Install Xcode from App Store. Then, install Command Line Tools from the inside of Xcode.~
 Xcode > Open Developer Tool > More Developer Tools
Or, opening up Terminal, apply the command below~
 xcode-select –install

>
3. Installing homebrew~
homebrew is a package installer. To use homebrew, install the software packages listed below.~
- automake
- libtool
- cmake

>
Cmake can be installed from the dmg file, which can be downloaded the wehis article uses the homebrew.~
To install homebrew, open up Terminal, apply the command line below.~
 $ ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”
~
To check whether homebrew is installed correctly or not, apply the commands below for updating homebrew.~
 $ brew update
 $ brew doctor
~
If there are no problems on the installation of homebrew, install the packages listed above.~
 $ brew install automake libtool cmake
~

>
4.  Downloading source code of NuPIC~
Check out source code from git. If you wish to contribute your modified code to the project of NuPIC, you will need your own git account.~
 $ cd ~
 $ mkdir work
 $ cd work
 $ git clone https://github.com/numenta/nupic.git

>
5. Configuring environment variable~
To set up the environment variable, which is required for building and executing NuPIC, record the information of PATH and others on .profile file.~
Usually this file is set to be invisible. Please use Terminal to find this file.~
 ~/.profile
~
Configure environment variables, which are needed for building and executing NuPIC. Open up ''.profile,'' and write down the information shown below.~
 # The directory of source repository where it is  git checkout 
 export NUPIC=~/work/nupic
 # Installation PATH of NTA
 export NTA=$NUPIC/nta/eng
 # Temporary Build file PATH
 export BUILDDIR=/tmp/ntabuild
 # Number of concurrent jobs for building (i.e. number of CPU cores + 1)
 export MK_JOBS=3
 # Configuration for other required environment variables
 source $NUPIC/env.sh
~
Then, go back to Terminal, open up .profile file, and make sure the information above is written correctly.~
 $ printenv 

>
6. Installing pip~
Installing pip, which is a package manager for Python.~
 $ sudo easy_install pip

>
7. Installing Python libraries~
Using pip, install Python libraries, which are required for NuPIC.~
 $ sudo pip install -r $NUPIC/external/common/requirements.txt
If you use pip 1.5 or later, you may apply the command line below.~ 
 $ sudo pip install --allow-all-external --allow-unverified PILL --allow-unverified psutil -r $NUPIC/external/common/requirements.txt
~
If you encounter a permission denied error when you use pip, please run pip with sudo. For farther details of the error, please visit [[this page>https://github.com/numenta/nupic/blob/master/README.md]].~

>
8. Building and Installing NuPIC~
 Move to the NuPIC installation directory and execute the command below.~
 Python setup.py install
If you can see the message listed below, the installation of NuPIC is successful.~
 $ $NUPIC/build.sh
 ...
 ...
 ...
 Stdout redirected to; /Users/otsuka/work/nupic/build_system/stdout.txt
 Build successful.
~
If you face a permission denied error when you use NuPIC, please execute NuPIC with sudo. Please go to [[this page>https://github.com/numenta/nupic/blob/master/README.md]] for more information.~

* Test [#md9192d3]
>
Please test that NuPIC can be executed properly when it is successfully built and installed.~

** C++ Test [#j60baad1]
>
 $ cd $NTA/bin
~
 $ htmtest
 ...
 ... Skipping
 ...
 ― ALL TESTS PASSES ―
 -- ALL TESTS PASSES --
~
 $ testeverything
 ...
 ... Skipping
 ...
 *******************************************************************
 * Numenta Unit Test summary
 *
 * Total categories = 39
 * Total tests = 2252
 * Total passed   = 2252
 * Total disabled = 0
 * Total failed   = 0
 * Total critical failures = 0
 * Success rate = 100
 *******************************************************************

** Python Unit Test [#c3f82012]
>
 $ cd $NUPIC
~
 $ $NUPIC/run_tests.sh
 ============================= test session starts ==============================
 platform darwin -- Python 2.7.5 -- pytest-2.4.2 -- /usr/bin/python
 plugins: cov, xdist
 collected 697 items / 2 skipped 
 …
 … Skipping
 ...
 =================== 687 passed, 12 skipped in 150.86 seconds ===================


** Caution [#uad9ceb5]
>
You cannot build application with GUI of Xcode, even though it is built with Cmake.

*** Versions of Command Tools [#g07bcf5b]
>
 $ python -V
 Python 2.7.5
~
 $ pip -V
 pip 1.5.4 from /Library/Python/2.7/site-packages/pip-1.5.4-py2.7.egg (python 2.7)
~
 $ clang -v
 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
 Target: x86_64-apple-darwin13.1.0
 Thread model: posix
~
 $ brew --version
 0.9.5
~
 $ brew list
 autoconf     automake     cmake     libtool

* Revision History [#dc669f0c]
>
- 2015/01/05 This article is initially uploaded

Front page   Edit Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes