Installing with mac and virtual environments

I’ve been trying to install nupic on OS Mojave 10.14 and have hit some issues.
My initial understanding was that the python 3 version is still WIP & runs on windows, so I looked into environments. But using an Anaconda activated python=2.7 runs into version-related errors on ‘pip install nupic’ (and I know conda and pip doesn’t always go well together regardless).
Pyenv gives similar egg.info related crashes. The error logs are long but normally involve some syntax which makes me think I’m just using incompatible versions/environment software.

Has anyone been able to get nupic running on mac using a virtual environment or other solution? I’m worried that uninstalling 3 and switching to 2 globally on my system will mess up jupyter and some other python programs I have. Apologies if this is an excessively basic question - I found HTM a couple days ago and wanted to experiment with encoders.

I checked out similar threads here; PyPI install of the community edition (https://github.com/htm-community/htm.core) worked after installing hexy and downgrading pytest, and I can import the htm.core libraries from GitHub examples. Is this the easiest solution for HTM with python 3?

2 Likes

If you want to stick to Python 3 you are better off installing the community Python 3/C++ htm port of nupic: htm.core
That installs fine on MacOS.

1 Like

As one of the htm.core maintainers, I recommend installing htm.core from a full source build rather than using PyPi because the PyPi builds only support a limited number of OS and Python versions. To build from sources, clone the repo and follow the instructions in README.md

1 Like

Thanks for the info. I installed htm.core with PyPi before posting, but on loading hotgym.py example from the github I get some errors on predictor.infer().

—> 30 pdf = predictor.infer( tm.getActiveCells() )
31 for n in (1, 5):
32 if pdf[n]:

RuntimeError: CHECK FAILED: “dimensions_ != 0” Classifier:
must call learn before infer.

Running the hotgym.py file itself in a cloned repo gives me ‘no module named numpy found’ even though I’ve installed numpy normally on my system; I’ll look into a source build rather than PyPi.
Perhaps I’m just missing something fundamental in the code structure; I’ll read up a bit more on how to get htm.core to work.

It looks like I should be able to follow the nupic API documentation while referencing the htm.core API differences for syntax.

1 Like

hello.

Before starting the build, you need to specify the environment variables. Try setting an environment variable in .bash_profile.

    export ARCHFLAGS="-arch x86_64"

This works on my mac.

1 Like