Set python version for use by swarm

I’m running nupic on arch where I have python3 as my default python version, but python2 installed for nupic and a few other projects incompatible with python3. When I try to start a swarm, I connect to mysql ok, but encounter the error: Job 1000 failed with error: /usr/bin/python: Error while finding module specification for 'nupic.swarming.hypersearch_worker' (ModuleNotFoundError: No module named 'nupic'), which I think means that the swarm workers are using /usr/bin/python, which is pointing to /usr/bin/python3. Is there a config file somewhere I can tweak to have swarms use /usr/bin/python2 by default?

1 Like

Note that I was able to temporarily solve this by running:

mkdir ~/bin
ln -s /usr/bin/python2 ~/bin/python

Which can easily then be un-done by closing my terminal session. But it would be nice if I could just set a variable in a config file for nupic somewhere…

1 Like

I normally use pyenv to install and manage specific versions of python

1 Like

Why not use virtualenv ? You can set up a virtualenv environment using python2.7 and then from there use that environment to install nupic and run the examples.

cd mywork
virtualenv myenv2.7 -p python2.7 --system-site-packages
source myenv2.7/bin/activate
git clone <nupic>
cd nupic
python install
# run examples
1 Like