Is it possible to have python2 and python3 in the same compute environment?

chuck.headchuck.head Member, Domino Posts: 9
edited May 13 in How-To Guides
Our default environments (DADs) are separated between Python2 and Python3. This is mostly for simplicity sake as it helps us debug a users' environments and avoid confusion with libraries incompatibilities between versions. 

Python 2 is actually installed by default in all ubuntu environments, but to make the python 3 environment functionally python 3 only we typically symlink /usr/local/bin/python, /usr/local/bin/python3 and/or /usr/local/anaconda/bin/python. We also link pip and pip3. 

If you do want to have python 2 and python 3 in the same environment, you can do this. The one limitation is that Domino batch runs will always execute scripts with a straight python command.(e.g. "python main.py"). 

One workaround for this is that you can actually edit the batch run launch script to change python to python3 for example by adding the following to your environments pre-set up script. 

echo "Running Python3 code"
sed -i 's/python/python3/g' /tmp/launch/command.sh
  



Sign In or Register to comment.