Update apt-get
sudo apt-get update
sudo apt-get upgrade # optional
Setup Python 2.7 Development Environment
This command requires administrator access.
sudo apt-get install build-essential python-dev libsqlite3-dev libreadline6-dev libgdbm-dev zlib1g-dev libbz2-dev sqlite3 zip
Install required packages
These may already be installed, depending on your system. This command requires administrator access.
sudo apt-get install python-pip mysql-server
Now that pip
is installed, install numpy
.
pip install numpy
NOTE: During this installation, you may be prompted to enter a MySQL password for the
root
user. If you provide your own root password, you will need to update your MySQL settings in the NuPIC configuration file.
git
: for cloning the NuPIC repositorypython-dev
: to get Python headers for compiling C++ with SWIGpython-pip
: for python package installation of required NuPIC python dependenciesautomake
: for C++ buildlibtool
: GNU tool for creating portable compiled binarieslibssl-dev
: encryption librariesg++
: GNU C++ compilercmake
: cross-platform, open-source make systemmysql-server
: Used for swarminglibpcre3-dev
: Perl Compatible Regular Expressions development library (for SWIG compilation below, only required for 32b systems)numpy
: Python math package
NOTE: You may also need to install numpy to get your installation to work. Personally, I used
sudo apt-get install numpy
since I didn’t know exactly which package caused the install to complain.
Install GCC 4.8
gcc4.8
is required for C++11. You may do this however you like. But here are some instructions for one way of doing it.
** gcc-4.8 is required by NuPIC now ** and it is also default on most Ubuntu systems (14.04 LTS +)
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
sudo update-alternatives --config gcc
(Choose the option for the new 4.8 compiler)
Clone the NuPIC repo
Change to the directory where you want to keep the nupic repo:
git clone https://github.com/numenta/nupic.git
This will create a nupic
directory containing the NuPIC source code in the current directory.
Set the NUPIC environment variable
export NUPIC=$PWD/nupic
Build NuPIC
python setup.py install --user
Troubleshooting
If you have problems with the python setup.py install
command, try cleaning out your local checkout by running git clean -dfx
. WARNING: This will clear out any local files that are not controlled by git.
Not enough memory for compilation
If you run in VM (or on a system with quite low RAM), for compilation it seems the gcc
requires atleast 2GB RAM memory, otherwise you can see errors like in this thread