Table of Contents

Software – Python Virtual Environments

Python is available across all systems, The version of Python will be different depending on the system’s OS.

This enables you to build your python environment without root access, as well as making it much more portable across systems, plus it’s really simple to do.

Python Versions

SystemVersionNotes
CentOS 7Python 2.7Default
CentOS 7Python 3.6python3
CentOS 7Python 3.8source /opt/rh/rh-python38/enable
Rocky 9Python 3.9Default
Fedora 36Python 3.10Default
Fedora 38Python 3.11Default
AnyAnyBYOP (See below)

Custom Python Versions

If you require a specific version of Python then you can use PyEnv to locally download most specific python versions. See more at PyEnv on Github.

Create Environment

Python 3

To create a Python3 virtual environment

python3 -m virtualenv <environment_name>

or if that doesn’t work

python3 -m venv <environment_name>

Python 2.7 (Deprecated)

To create a Python2 virtual environment (CentOS 7 Only)

python2 -m virtualenv <environment_name>

Python 2.7 has been deprecated and no longer receives official support, you should migrate your code-base to python3 for continued working support. We cannot guarantee that python2 will continue to be available.

If you need to run a python2 virtual environment on the Fedora Desktops, then first create the Environment on a CentOS 7 based system and activate it on Fedora. However, we cannot recommend this work-around.

Use the Environment

Source the environment for your shell

source <environment_name>/bin/activate
or
source <environment_name>/bin/activate.csh
or
source <environment_name>/bin/activate.fish

then you can run pip/pip3 etc as you wish.

Leave the Environment

deactivate

Known Issues with Virtual Environments

People with large 1GB+ environments especially when it’s lots of little files sometimes find that the activation can take a long time.

BYOP – Bring Your Own Python

Please see here: https://github.com/pyenv/pyenv

More details to come.