Problems using a Nupic example (Hotgym)

Okay, I installed it with the “–user”

I still get the same error with though

An no error?

Right, because we are not done yet. :wink:

Now you run pip install nupic --user. If that works, set the $NUPIC env var to your checkout directory and run python $NUPIC/examples/swarm/ to see if you have MySQL set up right.

“Successfully installed numpy-1.8.2 nupic.bindings-0.4.3 pytest-2.7.2”

“Connection successful”

Now I get the same error I get on my Windows machine when I run

$ python
This script runs a swarm on the input data (rec-center-hourly.csv) and
creates a model parameters file in the `model_params` directory containing
the best model found by the swarm. Dumps a bunch of crud to stdout because
that is just what swarming does at this point. You really don't need to
pay any attention to it.

= Swarming on rec-center-hourly data...
= Medium swarm. Sit back and relax, this could take awhile.
Generating experiment files in directory: /home/misa/Desktop/My Stuff/programming stuff/Nupic/nupic-master/examples/opf/clients/hotgym/prediction/one_gym/swarm...
Writing  313 lines...
Writing  114 lines...
Successfully submitted new HyperSearch job, jobID=1010
Evaluated 0 models
HyperSearch finished!
Worker completion message: None

Results from all experiments:
Generating experiment files in directory: /tmp/tmp0lzaX6...
Writing  313 lines...
Writing  114 lines...
json.loads(jobInfo.results) raised an exception.  Here is some info to help with debugging:
jobInfo:  _jobInfoNamedTuple(jobId=1010, client=u'GRP', clientInfo=u'', clientKey=u'', cmdLine=u'$HYPERSEARCH', params=u'{"hsVersion": "v2", "maxModels": null, "persistentJobGUID": "c1cfb836-1faf-11e6-812a-ac7ba1e42884", "useTerminators": false, "description": {"includedFields": [{"fieldName": "timestamp", "fieldType": "datetime"}, {"maxValue": 53.0, "fieldName": "kw_energy_consumption", "fieldType": "float", "minValue": 0.0}], "streamDef": {"info": "kw_energy_consumption", "version": 1, "streams": [{"info": "Rec Center", "source": "file://rec-center-hourly.csv", "columns": ["*"]}]}, "inferenceType": "TemporalMultiStep", "inferenceArgs": {"predictionSteps": [1], "predictedField": "kw_energy_consumption"}, "iterationCount": -1, "swarmSize": "medium"}}', jobHash='\xc1\xcf\xb87\x1f\xaf\x11\xe6\x81*\xac{\xa1\xe4(\x84', status=u'notStarted', completionReason=None, completionMsg=None, workerCompletionReason=u'success', workerCompletionMsg=None, cancel=0, startTime=None, endTime=None, results=None, engJobType=u'hypersearch', minimumWorkers=1, maximumWorkers=4, priority=0, engAllocateNewWorkers=1, engUntendedDeadWorkers=0, numFailedWorkers=0, lastFailedWorkerErrorMsg=None, engCleaningStatus=u'notdone', genBaseDescription=None, genPermutations=None, engLastUpdateTime=datetime.datetime(2016, 5, 21, 23, 57, 21), engCjmConnId=None, engWorkerState=None, engStatus=None, engModelMilestones=None)
jobInfo.results:  None
EXCEPTION:  expected string or buffer
Traceback (most recent call last):
  File "", line 109, in <module>
  File "", line 101, in swarm
    modelParams = swarmForBestModelParams(SWARM_DESCRIPTION, name)
  File "", line 78, in swarmForBestModelParams
  File "/home/misa/.local/lib/python2.7/site-packages/nupic/swarming/", line 277, in runWithConfig
    return _runAction(runOptions)
  File "/home/misa/.local/lib/python2.7/site-packages/nupic/swarming/", line 218, in _runAction
    returnValue = _runHyperSearch(runOptions)
  File "/home/misa/.local/lib/python2.7/site-packages/nupic/swarming/", line 161, in _runHyperSearch
  File "/home/misa/.local/lib/python2.7/site-packages/nupic/swarming/", line 828, in generateReport
    results = json.loads(jobInfo.results)
  File "/home/misa/.local/lib/python2.7/site-packages/nupic/swarming/", line 163, in loads
    json.loads(s, object_hook=objectDecoderHook, **kwargs))
  File "/usr/lib/python2.7/json/", line 351, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/usr/lib/python2.7/json/", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

I hate that error. I’ve seen it before:

Can you try one thing… set an environment variable called NUPIC to point to the absolute path to your nupic code checkout and try again. If that doesn’t work, one more thing to try in this comment:

It doesn’t work with the absolute path, i.e.,:

$ echo $NUPIC

and it doesn’t work with:

$ echo $NUPIC

It didn’t work, with this environment variable either:

$ echo $NUPIC

So where we just supposed to run that code as Pehlert said? Or where we supposed to replace “Location” with something else? I just ran it as he said we should run it.

I also tried running it with “sudo -s” enabled as suggested by Lovekeshvig but that didn’t work either.

This doesn’t look good. I haven’t tried getting NuPIC installed on Kubuntu in a long time. Can you try running the simple hotgym example without swarming?

> cd examples/opf/clients/hotgym/simple
> python
INFO:__main__:After 100 records, 1-step altMAPE=38.390240
INFO:__main__:After 200 records, 1-step altMAPE=29.214768
INFO:__main__:After 300 records, 1-step altMAPE=25.829702
INFO:__main__:After 400 records, 1-step altMAPE=24.262638
INFO:__main__:After 500 records, 1-step altMAPE=22.976900
INFO:__main__:After 600 records, 1-step altMAPE=22.890111
INFO:__main__:After 700 records, 1-step altMAPE=22.579927
INFO:__main__:After 800 records, 1-step altMAPE=22.859475
INFO:__main__:After 900 records, 1-step altMAPE=23.299378
INFO:__main__:After 1000 records, 1-step altMAPE=23.396538

If you get output like this, NuPIC is probably installed properly. There may still be a problem with swarming, however.

$ python
Traceback (most recent call last):
  File "", line 97, in <module>
  File "", line 82, in runHotgym
    result =
  File "/usr/lib/python2.7/dist-packages/nupic/frameworks/opf/", line 384, in run
  File "/usr/lib/python2.7/dist-packages/nupic/frameworks/opf/", line 469, in _sensorCompute
  File "/usr/lib/python2.7/dist-packages/nupic/engine/", line 446, in compute
    return self._region.compute()
  File "/home/misa/.local/lib/python2.7/site-packages/nupic/bindings/", line 1393, in compute
    return _engine_internal.Region_compute(self)
AttributeError: 'RecordSensor' object has no attribute 'guardedCompute'

I forgot to tell you to re-run pip install nupic --user again!

Installing collected packages: numpy, pytest
Successfully installed numpy-1.8.2 pytest-2.7.2

I still get the same error as listed above.

I can get onto an IRC if you want.

Sorry, but I can’t right now. I have never seen that error before. I’m not sure what it means, but I have a suspicion that there is something wrong with the nupic.bindings installation. Let’s try from scratch one more time in case we polluted something along the way…

# run these twice just to ensure it's really gone
> pip uninstall nupic -y
> pip uninstall nupic -y
> pip uninstall nupic.bindings -y
> pip uninstall nupic.bindings -y
> pip install --user
> pip install nupic --user

Please paste the complete output of all these comments into gist or pastebin.

Now that I think about it… the issue is probably because the binary was built on Ubuntu and you are trying to run it on Kubuntu. I don’t know about the architectural differences between these two platforms, but if that is the case, you’re going to need to compile from scratch on your Kubuntu system. This tutorial will help you identify the dependencies you’ll need to have installed to compile, but it won’t provide verbatim instructions.

I get an error when doing the tutorial, at the “make -j4” step. The error I get is posted on gist.github. Then of course if I run the command after that “make install” then I also get an error (second thing on gist.github). So I can’t run the command after that “cd $NUPIC_CORE/build/release/bin” because the “release” directory doesn’t exist in the “build” directory.

Is that the entire output of the make command?

No, the rest is gone, I just retrieved what my console had. I guess I could’ve ran some command to write the output to a file, but I forgot…

Honestly, I don’t know how to help you. I’ve never seen that compile error before, and I don’t know what bed.h is.

I think bed.h is just something from the previous line of code…there were thousands of lines of code being outputted so my console couldn’t keep all of it…

I’ll try to install a VM with Ubuntu 14.04, and try NuPIC that way.

I think the bed.h thing is a red herring. I have an idea, try to manually install the yaml packages as described here:

You might need to change the method for kubuntu.

@Addonis ’ system is proof positive of the existence of gremlins! :stuck_out_tongue: I think I went through this with him and the OpenJDK issue? Was that you @Addonis?

I installed them using the pip command, and the apt-get command. It was successful.

I still get the error when I run the “make -j4” though.
Here are some of the output from running that command:

Well, Kubuntu 15.04 & 15.10 is pretty unstable, although it was worse when it launched. I’m thinking of upgrading to 16.04.

Yea, I am having issues with Java too. But my Windows machine has even more problems. So at least that’s good…

1 Like