[[OS X]]

# Contents
[[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
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

>
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
>
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.
<Code>
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
~

To check whether homebrew is installed correctly or not, apply the commands below for updating homebrew.
<Code>

If there are no problems on the installation of homebrew, install the packages listed above.
<Code>

4. Downloading source code of NuPIC
>
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.~
<Code>
 $ cd ~
 $ mkdir work
 $ cd work
 $ git clone https://github.com/numenta/nupic.git

5.  Configuring environment variable
>
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.~
<Code>

 ~/.profile
~
Configure environment variables, which are needed for building and executing NuPIC. Open up ''.profile,'' and write down the information shown below.~
<Code #git....>
 # 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 

Then, go back to Terminal, open up .profile file, and make sure the information above is written correctly.
<Code $ printenv>
>
6. Installing pip~
Installing pip, which is a package manager for Python.~
 $ sudo easy_install pip

6. Installing pip
Installing pip, which is a package manager for Python.
 <Code>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 &#8213;allow-all-external &#8213;allow-unverified PILL &#8213;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]].~

7. Installing Python libraries
Using pip, install Python libraries, which are required for NuPIC.
<Code>
If you use pip 1.5 or later, you may apply the command line below 
<Code>
>
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 for more information.~

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]].
* Test [#md9192d3]
>
Please test that NuPIC can be executed properly when it is successfully built and installed.~


8. Building and Installing NuPIC
 Move to the NuPIC installation directory and execute the command below.
 <Code>Python setup.py install<Code>
<Code>
If you can see the message listed above, the installation of NuPIC is successful.

If you face a permission denied error when you use NuPIC, please execute NuPIC with sudo. Please go to this page for more information.

* Test [#md9192d3]
Please test that NuPIC can be executed properly when it is successfully built and installed.
** C++ Test [#j60baad1]
<Code>
<Code>
<Code>
>
 $ cd $NTA/bin
~
 $ htmtest
 ...
 ... Skipping
 ...
 &#8213; ALL TESTS PASSES &#8213;
~
 $ 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]
<Code>
<Code>
>
 $ 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 &#8213;version
 0.9.5
~
 $ brew list
 autoconf     automake     cmake     libtool

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



Front page   New List of pages Search Recent changes   RSS of recent changes