Running NuPIC on Cloud: Amazon EC2, Google GCE, GROK

Most common cloud alternatives for deploying/testing NuPIC

  1. Amazon AWS EC2
  2. Google GCE
  3. GROK

Community Image

  1. From the main AWS console select the US West (Oregon) region
  2. Click on EC2
  3. From the EC2 console click on Images -> AMIs
  4. Filter by “Public Images” (Not “Owned by Me”)
  5. Search for “ami-61bac551” or “NuPIC” (case matters)
  6. Check the image named “NuPIC-a709a3”
  7. Click “Launch”
  8. Select at least an m3.medium instance (Micro instance fails to compile due to insufficient memory)
  9. Click “Review and Launch”
  10. Click “Launch”
  11. Choose an ssh key pair you have access to.
  12. Remote connect to EC2 instance using SSH and have fun!

Install From Base Amazon Linux

  1. Start an Amazon EC2 instance
  • Use Quick Launch Instance
  • Amazon Linux AMI 2014.03.2
  • Select at least an m3.medium instance (Micro instance fails to compile due to insufficient memory)
  1. Remote connect to EC2 instance using SSH and run the following series of commands:

     # Amazon Linux
     sudo yum -y update
     sudo yum -y groupinstall 'Development Tools'
     sudo yum -y install python-devel
     sudo yum -y install openssl-devel
     sudo yum -y install make automake gcc gcc-c++ kernel-devel git-core
     sudo yum -y install cmake
    
    
     # Install python 2.7 and change default python symlink 
     # Modified from http://www.lecloud.net/post/61401763496/install-update-to-python-2-7-and-latest-pip-on-ec2
    
     sudo yum install python27-devel -y 
     sudo rm /usr/bin/python
     sudo ln -s /usr/bin/python2.7 /usr/bin/python 
    
     # Yum still needs 2.6, so write it in and backup script 
     sudo cp /usr/bin/yum /usr/bin/_yum_before_27 
     sudo sed -i s/python/python2.6/g /usr/bin/yum 
     sudo sed -i s/python2.6/python2.6/g /usr/bin/yum 
    
     # Install pip so that it installs to 2.7
     curl -O http://python-distribute.org/distribute_setup.py
     sudo /usr/bin/python27 distribute_setup.py
     sudo /usr/bin/easy_install-2.7 pip
    
     # Install mysql and set to start on boot
     sudo yum install mysql-server -y
     sudo chkconfig mysqld on
     sudo service mysqld start
    
     # Install Nupic
     git clone https://github.com/numenta/nupic
    
     cd nupic
     sudo pip install --allow-all-external --allow-unverified PIL --allow-unverified psutil -r external/common/requirements.txt
    
     # Update bashrc
     echo "export NUPIC='/home/ec2-user/nupic'" >> /home/ec2-user/.bashrc
     echo "export NTA=\$NUPIC/build/release" >> /home/ec2-user/.bashrc
     echo "export PYTHONPATH=\$PYTHONPATH:\$NTA/lib/python2.7/site-packages" >> /home/ec2-user/.bashrc
     source ~/.bashrc
    
     mkdir -p $NUPIC/build/scripts
     cd $NUPIC/build/scripts
     cmake $NUPIC
    
     cd $NUPIC/build/scripts
     make -j3
    
     # Run all tests!
     make tests_all
1 Like

I have followed the steps to start an EC2 instance with the NuPIC AMI. Quick question is this AMI still supported?

A simple test in python “import nupic” throws some errors:

[ec2-user@ip- ~]$ python
Python 2.6.9 (unknown, Nov  2 2017, 19:21:21)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nupic
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ec2-user/nupic/build/release/lib/python2.7/site-packages/nupic/__init__.py", line 25, in <module>
    from nupic.bindings import engine_internal
  File "/home/ec2-user/nupic/build/release/lib/python2.7/site-packages/nupic/bindings/engine_internal.py", line 6, in <module>
    import _engine_internal
ImportError: numpy.core.multiarray failed to import

Thanks,
Christian

1 Like

To answer my own question. After a “sudo yum -y update” I was able to import nupic using python2.7 executable!

2 Likes

I don’t seem to be able to find this AMI in AWS, am i missing something?

1 Like