Installing virtual environment (python 2.7.6)

I need to run some codes that are only compatible with python 2.7.6, but I am not sure how to install a virtual environment for the available python 2.7.6 at /usr/usc/python. For python 3.x versions, I always use the following command (e.g., for python 3.7.4):

/usr/usc/python/3.7.4/bin/python3 -m venv PATH_TO_ENV

But when I change the source python version to 2.7.6, this does not work, whether I use “venv” or “virtualenv” and I keep getting the same error: “/usr/usc/python/2.7.6/bin/python: No module named venv”. Does anyone know how I can resolve this issue?

Thanks

Hello, you will need to transition to Discovery soon as we will be decommissioning the old cluster in the next month or so. We have a Getting Started page here.

On Discovery, you can load Python 2.7.16 with the command:

module load python/2.7.16

Then, you can set up a virtual environment with a command like the following:

virtualenv </path/to/dir>/env

where you specify the directory path to install the environment in.