htm-community / htm.core

Actively developed Hierarchical Temporal Memory (HTM) community fork (continuation) of NuPIC. Implementation for C++ and Python
http://numenta.org
GNU Affero General Public License v3.0
151 stars 75 forks source link

Docker: Installing matplotlib #957

Open javadan opened 3 years ago

javadan commented 3 years ago

Hi

I'm trying to run this nupic.critic code

and I started with the official nupic docker, numenta/nupic, but pip wouldn't install anything because of 'SNIMissingWarning', which prevents urllib3 from doing something, blah blah blah, and the internet suggests installing pyOpenSSL but I can't get that to install either.

Ok, so I give up, and now I've found htm.core. Neither docker install builds, but I modify it to install pip/pip3 correctly, and give it a bash.

So I need matplotlib as a pre-req, and so I try pip/pip3 install it. And it gives this error:

  src/py_adaptors.h:13:10: fatal error: numpy/arrayobject.h: No such file or directory
     13 | #include "numpy/arrayobject.h"

(It's using Python 3.9) And the build fails. All the advice I've found suggests linking this file elsewhere. But the file doesn't exist. I grepped the /usr/lib folder for it. Not there. Numpy is there. But not this file.

So I'm back to the drawing board. Anyone tried to use the Dockers recently?

Should I maybe just switch the base to an OS like Ubuntu? Or try with Python 3.6/7/8?

I presume all this stuff is happening because Alpine or Python 3.9 is a bit iffy. But I don't know.

Thanks

ctrl-z-9000-times commented 3 years ago

Hi,

If you try Ubuntu, do not go for the latest version Ubuntu-20-LTS because that uses python 3.9 which we have not yet released a binary build for.

IIRC htm.core should just work on ubuntu 18-LTS.

HTH

javadan commented 3 years ago

Hmm thanks. Still stuck. Seems like the code has dependencies on files in nupic.core that aren't around anymore.

from nupic.data.inference_shifter import InferenceShifter from nupic.frameworks.opf.model_factory import ModelFactory

I can use the numenta/nupic docker to get these classes, but then I get stuck with the urllib3 / mathplotlib docker install.

Hmm. I tried pip installing nupic but it does Downloading nupic-0.5.6.tar.gz (4.6 MB) Downloading nupic-0.5.5.tar.gz (4.6 MB) Downloading nupic-0.5.4.tar.gz (4.6 MB) etc.

Any idea how I might get both nupic and mathplotlib working together?

Or, maybe how was InferenceShifter ported to htm.core? Not sure where to go from here. Might need to look into autoencoder based anomaly detection instead. Basically trying to do unsupervised anomaly detection on audio.

ctrl-z-9000-times commented 3 years ago

Uhh, I probably should have noticed this sooner but nupic.critic requires nupic (not htm.core) which was the predecessor of this project. Nupic is difficult to install, as you found out...

You could try porting the old nupic.critic encoder to the new htm.core library?

There is also this other HTM-community project for encoding audio, but I'm not sure if that repo has a working encoder either. https://github.com/htm-community/nupic.audio

javadan commented 3 years ago

Thanks, yeah, that one also looks like it's dependent on the old Nupic, and uses matplotlib too. So I will run into that urllib3 bug again. I'll probably try bash my head against docker/matplotlib/urllib3 for a bit - I see that this bug is supposed to go away for python >= 2.7.9. So maybe I can change the python version in the docker, and get a bit farther.

But if that doesn't work, I'll try port nupic.audio or nupic.critic code to htm.core, one of these weekends. I have a pretty shallow understanding of the codebases, at the moment, so it's a bit daunting.