How I Painlessly Installed NUPIC with Conda on Ubuntu

#1

So this weekend I binge watched HTM school and got hooked. I wanted to give back to the community and it seemed like there was interest on using conda to install nupic but nobody on the team had experience with it. I wanted to get started running some code but wanted to use conda to help keep nupic in an isolated environment because I use python 3.7 for everything else. So I converted the requirements.txt and install instructions into an environment.yml file so a separate conda nupic environment could be created easily.

Ubuntu Version 18.04.2 LTS

  1. Git Clone https://github.com/numenta/nupic.git
  2. cd nupic
  3. paste this environment.yml file in the root
  4. conda env create -f environment.yml
  5. conda activate nupic
  6. pip install nupic

The end.

Hope this helps reduce some barriers to entry to HTMs for the conda crowd.

Note: I added some extra packages like jupyter, matplotlib. In a conda environment you will need to install these packages even if you already have them installed in a different python installation, that’s because the conda environment is walled off from everything else and only installs and runs things within it. So don’t be surprised if you follow my install steps and a package you normally use says module not installed now. That just means you need to install it into the environment. To do that:

  1. make sure your nupic environment is activated with: conda activate nupic
  2. with your environment active run conda install <package-you-want>
  3. if it can’t find your package, then go to anaconda.org and search for your package, usually you’ll be able to find an installation channel like so: conda install -c conda-forge pandas
  4. if you still can’t find the package but you know it’s in pip, you can just pip install it (again with your conda environment activated!!) The downside is when you pip install things into your environment conda can’t manage all the dependencies for you, which is why i always try to find a conda install version first before going to pip install
3 Likes

#2

Seriously it is that easy? :joy:

Thanks a bunch! I’ll check this out when I get back.

1 Like

#3

Let me know if you have any issues. Happy to help troubleshoot. My environment file takes advantage of the ability to use pip within a self contained conda environment rather than a global pip.

1 Like

#4

Welcome @Whamp and nice work! I wonder if this could solve the issue I’m having trying to implement NuPIC in a production system that’s in 3.7. I don’t suppose you have any intuitions about getting around that blocker? I come across one repo by @chhenning to make NuPIC work in python 3, so maybe that’s the simplest thing to try. I know very little about these kinds of compatibility problems, so if there were a relatively simple work-around I’d be grateful to find it lol. Thanks

1 Like

#5

If you have the ability to install anaconda or miniconda in production system then yes i think this will work. My system python is 3.7 but you can run any version of python you want within a conda environment without infecting any other code or environment.

You would just need to download the installer from here and then run this in the terminal to install:
(change to the file below to the exact version of miniconda or anaconda you downloaded)
bash Miniconda3-latest-Linux-x86_64.sh

more general anaconda install instructions can be found here and are very helpful for customizing your use case:
https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html

Info on installing conda on a system that already has other python installations:
https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html#installing-conda-on-a-system-that-has-other-python-installations-or-packages

1 Like