How to install NuPIC on raspberry pi

I have been struggling to install NuPIC on raspberry pi. Here is how to install NuPIC.

NuPIC Core

cloning ver. 0.6.1

git clone -b 0.6.1 https://github.com/numenta/nupic.core.git

sudo pip install -r bindings/py/requirements.txt
sudo python setup.py install

NuPIC
cloning ver. 0.6.0

git clone -b 0.6.0 https://github.com/numenta/nupic.git

modify setup.py as follows

def findRequirements():
  """
  Read the requirements.txt file and parse into requirements for setup's
  install_requirements option.
  """
  requirementsPath = os.path.join(REPO_DIR, "requirements.txt")
  requirements = parse_file(requirementsPath)

  #if nupicBindingsPrereleaseInstalled():  <- comment out
    # User has a pre-release version of nupic.bindings installed, which is only
    # possible if the user installed and built nupic.bindings from source and
    # it is up to the user to decide when to update nupic.bindings.  We'll
    # quietly remove the entry in requirements.txt so as to not conflate the
    # two.
    #requirements = [req for req in requirements if "nupic.bindings" not in req]  <- comment out

  return requirements

extras_require = {
      # Default requirement based on system type
      #":platform_system=='Linux' or platform_system=='Darwin'":  <-comment out
      #["pycapnp==0.5.8"],  <- comment out

      # Superseded by platform_system-conditional requirement, but keeping
      # empty extra for compatibility as recommended by setuptools doc.
      "capnp": [],
      "viz": ["networkx", "matplotlib", "pygraphviz"]
    },

modify requirements.txt as follows

nupic.bindings==0.6.1 <- from 0.6.0

python setup.py develop --user

2 Likes

Wow, really? That’s great work! Can anyone else attempt to install NuPIC on a Raspberry Pi and validate the instructions?

@koichi, this post doesn’t describe or provide logs for the problem that you encountered. Are you having trouble building pycapnp on raspberry pi? Without pycapnp, the new serialization functionality won’t be possible.

This is the story.

Nupic.core has been built without any troubles including pycapnp. One important point is NOT TO USE pyenv. Using pyenv, Nupic.core can not be properly built. This is my experience.

After installing Nupic.core, when building Nupic I have following error message.

    pi@raspberrypi:~/nupic $ python setup.py develop --user
    Traceback (most recent call last):
    File "setup.py", line 134, in <module>
    requirements = findRequirements()
    File "setup.py", line 121, in findRequirements
    if nupicBindingsPrereleaseInstalled():
    File "setup.py", line 55, in nupicBindingsPrereleaseInstalled
    if pkg_resources.parse_version(nupicDistribution.version).is_prerelease:
    AttributeError: 'tuple' object has no attribute 'is_prerelease'
    indent preformatted text by 4 spaces

When building Nupic.core, I have cloned the codes from Github without specifying version. So, I have specified the version 0.61.

git clone -b 0.6.1 https://github.com/numenta/nupic.core.git

At the same time, I have cloned Nupic specifying the version 0.6.0 to make sure.
git clone -b 0.6.0 https://github.com/numenta/nupic.git

But still I have the same error message. Then, I have checked Nupic setup.py and comment out the following function.

nupicBindingsPrereleaseInstalled(): <- comment out

Then the error message has been disappeared! Since I have installed the stable Nupic.core version 0.61, I think this check is not necessarily.

pi@raspberrypi:~/nupic $ python setup.py develop --user
error in nupic setup command: Invalid environment marker: platform_system=='Linux' or 
platform_system=='Darwin'`

To skip this check, I have commented out the following.

#":platform_system=='Linux' or platform_system=='Darwin'": <-comment out

#["pycapnp==0.5.8"], <- comment out
This may be my misunderstanding, it is not needed to comment out this line. Also, I have checked pycapnp 0.5.8 has been properly installed.

And I have changed nupic.bindgs version in requirements.txt.

That’s all.

So far Nupic.core and Nupic are working without any errors on Raspberry Pi.

It looks like your setuptools is too old. The second problem with environment markers is likely due to the same problem.

cc @rhyolight

1 Like

As I wrote, I have cloned Nupic ver. 0.6.0. As you can see Github log below. “setup.py” has been changed once after ver. 0.6.0. The change is not related for this issue.

Since NuPIC 0.7 has been released. I’ve upgraded NuPIC on raspberry pi.

Upgrade NuPIC.core to 0.6.3 and then setup NuPIC 0.7.0. This time NuPIC has been upgraded without any errors.

I’m wondering why ???

Thanx a lot for this. I have followed the steps and installed Nupic on my Pi but I can’t seem to use the classes like SpatialPooler, Classifiers etc. Also it would be really helpful of you if you kindly tell me the steps on how to upgrade Nupic on my Pi to the latest version. Thank you. :slight_smile:

I’d like to recommend you to install nupic.core and nupic following this post.

And do the test.

Good luck!

I have installed nupic.core and nupic following that post only.
When I am running the command nupic-bindings-check to do the test I get the following output:

pi@zeus:~ $ nupic-bindings-check
Traceback (most recent call last):
File “/usr/local/bin/nupic-bindings-check”, line 5, in
from pkg_resources import load_entry_point
File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 2876, in
working_set = WorkingSet._build_master()
File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 451, in _build_master
return cls._build_from_requirements(requires)
File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 464, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 639, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: numpy==1.11.2

Please help.

For nupic.core installation, do you follow “Developer-installation”?

So far, I have installed nupic.core following above procedure. Of course before those procedure, you have to install dependencies such as numpy.

Have you checked right version of numpy? That’s 1.11.2. Please check version of installed numpy.

Thanks a lot for your help. I was able to run it finally. :slight_smile:

1 Like

My great pleasure! Have fun.

1 Like

Can you post your python path?

Also, did you pass the tests as in

py.test tests/unit

I have done the installation as shown by Koichi but my tests fail. (20/738)

Thanks

I tried running the OPF framework on nupic installed in my RaspberryPi but I have been getting a few errors. My code was written in the latest version of nupic 0.7 in my desktop but the raspberryPi has an older version of Nupic 0.6.1(which I installed following the instruction given here: https://github.com/numenta/nupic.core#developer-installation).
I have tried to run a previously created ModelParameter from the version 0.7 (from my desktop) but there are a few errors coming with few names in R-Pi board. I renamed a few function / parameter name to solve them.
Last one was: changing tmParams to tpParams.
Now I am stuck at:

nupic region object has no attribute ‘purgeInputLinkBufferheads’

I expect same renaming mechanism will solve this problem too…but I doubt is it the right mechanism to solve this problem or I am just digging into dark ?

Please help on how i can fix this. Thanks.

Here is the list of breaking changes.