Error trying to save OPF model

Hi folks! I think I come across some issue when trying to save the OPF model using

model.disableLearning()
model.save('/Users/myname/Documents/python/HTM/src/model/OPF.model')

The error are like following:

Traceback (most recent call last):
  File "/Users/myname/Documents/python/HTM/src/OPF.py", line 413, in <module>
    model.save('/Users/myname/Documents/python/HTM/src/model/OPF.model')
  File "/Users/myname/Documents/python/HTM/venv/lib/python2.7/site-packages/nupic/frameworks/opf/model.py", line 360, in save
    self._serializeExtraData(extraDataDir=self._getModelExtraDataDir(saveModelDir))
  File "/Users/myname/Documents/python/HTM/venv/lib/python2.7/site-packages/nupic/frameworks/opf/htm_prediction_model.py", line 1429, in _serializeExtraData
    self._netInfo.net.save(outputDir)
  File "/Users/myname/Documents/python/HTM/venv/lib/python2.7/site-packages/nupic/engine/__init__.py", line 729, in save
    engine_internal.Network.save(self, *args, **kwargs)
  File "/Users/myname/Documents/python/HTM/venv/lib/python2.7/site-packages/nupic/bindings/engine_internal.py", line 1214, in save
    return _engine_internal.Network_save(self, *args, **kwargs)
SystemError: NULL result without error in PyObject_Cal

Can anybody help me with this? I have been stuck here for a long time. Thanks!

I’m not sure that NuPIC is installed correctly. How did you install it?

Thanks Rhyolight!
I think I install nupic in Pycharm CE, and I use Python 2.7. I’d appreciate any suggestions or experience. Thanks!

I would suggest you do not install NuPIC through an IDE. Do you know how to use pip? I suggest you install nupic with pip.

1 Like

Thanks Rhoylight! I have tried the way you suggested. I can generate anomaly score but still the same error shows up when I tried to save the model.

By the way, I think maybe python 2 has some bug in pickling large arrays, which leads to this SystemError as you described in https://github.com/numenta/nupic/issues/1231, which I really appreciate. But seems like this python bug has already been resolved in environment >= python 3.3. So I am wondering if nupic has already been compatible with python 3.3+? If not, I’d appreciate any suggestion/reference on how to set model parameters so that the array size will not exceed the array limit when saving the model?

I’d appreciate any suggestion. Thanks!