Virtual environments

A virtual environment is an isolated workspace that allows users to run software with its own dependencies, configurations, and even language versions—separate from the system-wide setup. While Python virtual environments are a common example, the concept applies to other languages and tools as well, such as Node.js with nvm, Ruby with rbenv, or containerized environments like Docker.

In environments like HPC (High-Performance Computing) systems, where users often lack permissions to change the global setup, virtual environments are essential. They help avoid conflicts between projects with different dependency requirements, allow for customized setups, and ensure reproducibility and stability. Whether managing software stacks for data science, web development, or research, virtual environments are a powerful way to maintain clean, project-specific configurations without interfering with the system’s core installation.

By using virtual environments, you can create dedicated setups for specific projects or tasks, ensuring that dependencies remain isolated and don’t interfere with one another. This makes it easier to manage multiple projects with different requirements while keeping the system Python untouched.

For more details, refer to the official Python documentation on virtual environments.
https://hpc-wiki.info/hpc/How_to_virtual_environments.

Python Libraries

Python virtual environment modules supports creating lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories. This isolation helps prevent conflicts between projects requiring different package versions. Libraries like venv or virtualenv are commonly used to create these environments, making it easier to manage dependencies for individual projects.

venv

The module venv is used to create a virtual environment. Cluster users will have to load the version of python they need first with a module load command. The venv module supports creating lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories.

Installing Virtual Environment Tools

A built-in module in Python for creating virtual environments. No need to install separately, but ensure you’re using Python 3.3 or later.

Creating a Virtual Environment:

Users must first load their desired Python version using the module load command.

Once they selected the version of python they want, they can create their virtual environment. These environments can be large, depending on what packages are installed, so it is recommended that they are created in a space other than the home directory. To create a python3 environment named my_venv in the current directory, a user would run:

%%bash
rm -rf my_venv  #This would delete the `my_venv` virtual environment folder if it exists
# load python 3.13
echo "Loading python 3.11 via module"
module load Python/3.13.1-GCCcore-14.2.0

# print out the found python executable
echo "Python3 used is:"
which python3
# now create a new virtual environment `my_venv`
echo " Creating venv 'my_venv' "
python3 -m venv --upgrade-deps my_venv
# use --upgrade-deps to automatically update to the latest pip & setuptools versions

echo "venv created:"
readlink -f my_venv
Loading python 3.11 via module
The following have been reloaded with a version change:
  1) GCCcore/13.2.0 => GCCcore/14.2.0
  2) Python/3.11.5-GCCcore-13.2.0 => Python/3.13.1-GCCcore-14.2.0
  3) SQLite/3.43.1-GCCcore-13.2.0 => SQLite/3.47.2-GCCcore-14.2.0
  4) Tcl/8.6.13-GCCcore-13.2.0 => Tcl/8.6.16-GCCcore-14.2.0
  5) XZ/5.4.4-GCCcore-13.2.0 => XZ/5.6.3-GCCcore-14.2.0
  6) binutils/2.40-GCCcore-13.2.0 => binutils/2.42-GCCcore-14.2.0
  7) bzip2/1.0.8-GCCcore-13.2.0 => bzip2/1.0.8-GCCcore-14.2.0
  8) libffi/3.4.4-GCCcore-13.2.0 => libffi/3.4.5-GCCcore-14.2.0
  9) libreadline/8.2-GCCcore-13.2.0 => libreadline/8.2-GCCcore-14.2.0
 10) ncurses/6.4-GCCcore-13.2.0 => ncurses/6.5-GCCcore-14.2.0
 11) zlib/1.2.13-GCCcore-13.2.0 => zlib/1.3.1-GCCcore-14.2.0
Python3 used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python3
 Creating venv 'my_venv' 
venv created:
/home/gth/it4i_course/my_venv

This will create the directory Test1 as well as subdirectories with the files for running Python in the current directory.

#!rm -rf my_venv

This would delete the my_venv virtual environment folder if it exists

Activating the Virtual Environment:

%%bash
echo "Activating a Python Virtual Environment"
source my_venv/bin/activate
echo "full path to the pip executable currently being used:"
which pip
Activating a Python Virtual Environment
full path to the pip executable currently being used:
/home/gth/it4i_course/my_venv/bin/pip

Once the environment is created, it needs to be activated to install packages and be used. Activating the environment can be done by running the source command with the path to the activate script that was created with the environment. For the Test1 example created above, the command would be:

Installing Packages:

Use pip to install packages within venv:

%%bash

# load python 3.13
echo "Loading python 3.11 via module"
module load Python/3.13.1-GCCcore-14.2.0

# print out the found python executable
echo "Python3 used is:"
which python3
# now create a new virtual environment `my_venv`
echo "Activating a Python Virtual Environment"
source my_venv/bin/activate

echo "Displays a list of all installed Python packages in the current environment, along with their versions - location and installer."
pip list -v
echo "Installs a Python package (numpy) into the current environment"
pip install numpy
Loading python 3.11 via module
The following have been reloaded with a version change:
  1) GCCcore/13.2.0 => GCCcore/14.2.0
  2) Python/3.11.5-GCCcore-13.2.0 => Python/3.13.1-GCCcore-14.2.0
  3) SQLite/3.43.1-GCCcore-13.2.0 => SQLite/3.47.2-GCCcore-14.2.0
  4) Tcl/8.6.13-GCCcore-13.2.0 => Tcl/8.6.16-GCCcore-14.2.0
  5) XZ/5.4.4-GCCcore-13.2.0 => XZ/5.6.3-GCCcore-14.2.0
  6) binutils/2.40-GCCcore-13.2.0 => binutils/2.42-GCCcore-14.2.0
  7) bzip2/1.0.8-GCCcore-13.2.0 => bzip2/1.0.8-GCCcore-14.2.0
  8) libffi/3.4.4-GCCcore-13.2.0 => libffi/3.4.5-GCCcore-14.2.0
  9) libreadline/8.2-GCCcore-13.2.0 => libreadline/8.2-GCCcore-14.2.0
 10) ncurses/6.4-GCCcore-13.2.0 => ncurses/6.5-GCCcore-14.2.0
 11) zlib/1.2.13-GCCcore-13.2.0 => zlib/1.3.1-GCCcore-14.2.0
Python3 used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python3
Activating a Python Virtual Environment
Displays a list of all installed Python packages in the current environment, along with their versions - location and installer.
Package                           Version      Location                                                                         Installer
--------------------------------- ------------ -------------------------------------------------------------------------------- ---------
anyio                             4.3.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
appdirs                           1.4.4        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
argon2-cffi                       23.1.0       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
argon2-cffi-bindings              21.2.0       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
asn1crypto                        1.5.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
asttokens                         2.4.1        /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
async-lru                         2.0.4        /apps/all/JupyterLab/4.2.0-GCCcore-13.2.0/lib/python3.11/site-packages           pip
atomicwrites                      1.4.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
attrs                             23.1.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
Babel                             2.13.1       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
backcall                          0.2.0        /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
backports.entry-points-selectable 1.2.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
backports.functools-lru-cache     1.6.6        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
beautifulsoup4                    4.12.2       /apps/all/BeautifulSoup/4.12.2-GCCcore-13.2.0/lib/python3.11/site-packages       pip
bitarray                          2.8.2        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
bitstring                         4.1.2        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
bleach                            6.1.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
blist                             1.3.6        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
CacheControl                      0.13.1       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
cachy                             0.3.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
certifi                           2023.7.22    /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
cffi                              1.16.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
chardet                           5.2.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
charset-normalizer                3.3.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
cleo                              2.0.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
click                             8.1.7        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
cloudpickle                       3.0.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
colorama                          0.4.6        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
comm                              0.2.2        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
commonmark                        0.9.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
crashtest                         0.4.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
cryptography                      41.0.5       /apps/all/cryptography/41.0.5-GCCcore-13.2.0/lib/python3.11/site-packages        pip
Cython                            3.0.4        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
debugpy                           1.8.1        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
decorator                         5.1.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
defusedxml                        0.7.1        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
deprecation                       2.1.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
distlib                           0.3.7        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
distro                            1.8.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
docopt                            0.6.2        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
docutils                          0.20.1       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
doit                              0.36.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
dulwich                           0.21.6       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
ecdsa                             0.18.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
editables                         0.5          /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
exceptiongroup                    1.1.3        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
execnet                           2.0.2        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
executing                         2.0.1        /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
fastjsonschema                    2.19.1       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
filelock                          3.13.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
fsspec                            2023.10.0    /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
future                            0.18.3       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
glob2                             0.7          /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
h11                               0.14.0       /apps/all/JupyterLab/4.2.0-GCCcore-13.2.0/lib/python3.11/site-packages           pip
html5lib                          1.1          /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
httpcore                          1.0.5        /apps/all/JupyterLab/4.2.0-GCCcore-13.2.0/lib/python3.11/site-packages           pip
httpx                             0.27.0       /apps/all/JupyterLab/4.2.0-GCCcore-13.2.0/lib/python3.11/site-packages           pip
idna                              3.4          /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
imagesize                         1.4.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
importlib-metadata                6.8.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
importlib-resources               6.1.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
iniconfig                         2.0.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
intervaltree                      3.1.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
intreehooks                       1.0          /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
ipaddress                         1.0.23       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
ipykernel                         6.29.4       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
ipython                           8.17.2       /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
ipython-genutils                  0.2.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
ipywidgets                        8.1.2        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jaraco.classes                    3.3.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
jedi                              0.19.1       /apps/all/jedi/0.19.1-GCCcore-13.2.0/lib/python3.11/site-packages                pip
jeepney                           0.8.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
Jinja2                            3.1.2        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
joblib                            1.3.2        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
json5                             0.9.25       /apps/all/JupyterLab/4.2.0-GCCcore-13.2.0/lib/python3.11/site-packages           pip
jsonschema                        4.22.0       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jsonschema-specifications         2023.12.1    /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jupyter_client                    8.6.1        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jupyter_core                      5.7.2        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jupyter-events                    0.10.0       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jupyter-lsp                       2.2.5        /apps/all/JupyterLab/4.2.0-GCCcore-13.2.0/lib/python3.11/site-packages           pip
jupyter_packaging                 0.12.3       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jupyter_server                    2.14.0       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jupyter_server_terminals          0.5.3        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jupyterlab                        4.2.0        /apps/all/JupyterLab/4.2.0-GCCcore-13.2.0/lib/python3.11/site-packages           pip
jupyterlab_pygments               0.3.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
jupyterlab_server                 2.27.1       /apps/all/JupyterLab/4.2.0-GCCcore-13.2.0/lib/python3.11/site-packages           pip
jupyterlab-widgets                3.0.10       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
keyring                           24.2.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
keyrings.alt                      5.0.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
liac-arff                         2.5.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
lockfile                          0.12.2       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
lxml                              4.9.3        /apps/all/lxml/4.9.3-GCCcore-13.2.0/lib/python3.11/site-packages                 pip
markdown-it-py                    3.0.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
MarkupSafe                        2.1.3        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
matplotlib-inline                 0.1.6        /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
mdurl                             0.1.2        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
mistune                           3.0.2        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
mock                              5.1.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
more-itertools                    10.1.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
msgpack                           1.0.7        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
nbclient                          0.10.0       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
nbconvert                         7.16.4       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
nbformat                          5.10.4       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
nest-asyncio                      1.6.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
netaddr                           0.9.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
netifaces                         0.11.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
notebook                          7.2.0        /apps/all/JupyterNotebook/7.2.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
notebook_shim                     0.2.4        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
overrides                         7.7.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
packaging                         23.2         /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pandocfilters                     1.5.1        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
parso                             0.8.3        /apps/all/jedi/0.19.1-GCCcore-13.2.0/lib/python3.11/site-packages                pip
pastel                            0.2.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pathlib2                          2.3.7.post1  /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pathspec                          0.11.2       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pbr                               5.11.1       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pexpect                           4.8.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pickleshare                       0.7.5        /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
pip                               25.1         /home/gth/it4i_course/my_venv/lib/python3.13/site-packages                       pip
pkginfo                           1.9.6        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
platformdirs                      3.11.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pluggy                            1.3.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pooch                             1.8.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
prometheus-client                 0.20.0       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
prompt-toolkit                    3.0.41       /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
psutil                            5.9.6        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
ptyprocess                        0.7.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pure-eval                         0.2.2        /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
py                                1.11.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
py-expression-eval                0.3.14       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pyasn1                            0.5.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pycparser                         2.21         /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pycryptodome                      3.19.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pydevtool                         0.3.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
Pygments                          2.16.1       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pylev                             1.4.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
PyNaCl                            1.5.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pyparsing                         3.1.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pyrsistent                        0.20.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pytest                            7.4.3        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pytest-xdist                      3.3.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
python-dateutil                   2.8.2        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
python-json-logger                2.0.7        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
pytoml                            0.1.21       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
pytz                              2023.3.post1 /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
PyYAML                            6.0.1        /apps/all/PyYAML/6.0.1-GCCcore-13.2.0/lib/python3.11/site-packages               pip
pyzmq                             25.1.2       /apps/all/PyZMQ/25.1.2-GCCcore-13.2.0/lib/python3.11/site-packages               pip
rapidfuzz                         2.15.2       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
referencing                       0.35.1       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
regex                             2023.10.3    /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
requests                          2.31.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
requests-toolbelt                 1.0.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
rfc3339-validator                 0.1.4        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
rfc3986-validator                 0.1.1        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
rich                              13.6.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
rich-click                        1.7.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
rpds-py                           0.18.1       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
scandir                           1.10.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
SecretStorage                     3.3.3        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
semantic-version                  2.10.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
Send2Trash                        1.8.3        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
shellingham                       1.5.4        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
simplegeneric                     0.8.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
simplejson                        3.19.2       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
six                               1.16.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sniffio                           1.3.1        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
snowballstemmer                   2.2.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sortedcontainers                  2.4.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
soupsieve                         2.5          /apps/all/BeautifulSoup/4.12.2-GCCcore-13.2.0/lib/python3.11/site-packages       pip
sphinx-bootstrap-theme            0.8.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sphinxcontrib-applehelp           1.0.7        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sphinxcontrib-devhelp             1.0.5        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sphinxcontrib-htmlhelp            2.0.4        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sphinxcontrib-jsmath              1.0.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sphinxcontrib-qthelp              1.0.6        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sphinxcontrib-serializinghtml     1.1.9        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
sphinxcontrib-websupport          1.2.6        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
stack-data                        0.6.3        /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
tabulate                          0.9.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
terminado                         0.18.1       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
threadpoolctl                     3.2.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
tinycss2                          1.3.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
toml                              0.10.2       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
tomli                             2.0.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
tomli_w                           1.0.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
tomlkit                           0.12.1       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
tornado                           6.4          /apps/all/tornado/6.4-GCCcore-13.2.0/lib/python3.11/site-packages                pip
traitlets                         5.13.0       /apps/all/IPython/8.17.2-GCCcore-13.2.0/lib/python3.11/site-packages             pip
ujson                             5.8.0        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
urllib3                           2.0.7        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
virtualenv                        20.24.6      /apps/all/virtualenv/20.24.6-GCCcore-13.2.0/lib/python3.11/site-packages         pip
wcwidth                           0.2.8        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
webencodings                      0.5.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
websocket-client                  1.8.0        /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
widgetsnbextension                4.0.10       /apps/all/jupyter-server/2.14.0-GCCcore-13.2.0/lib/python3.11/site-packages      pip
xlrd                              2.0.1        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
zipfile36                         0.1.3        /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
zipp                              3.17.0       /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages pip
Installs a Python package (numpy) into the current environment
Collecting numpy
  Using cached numpy-2.2.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (62 kB)
Using cached numpy-2.2.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.1 MB)
Installing collected packages: numpy
Successfully installed numpy-2.2.5

Use –no-cache-dir option in pip install tells pip not to use or save any cached files when installing a package.
pip --no-cache-dir install pip --no-cache-dir uninstall

%%bash

# load python 3.13
echo "Loading python 3.11 via module"
module load Python/3.13.1-GCCcore-14.2.0

# print out the found python executable
echo "Python3 used is:"
which python3

echo "Activating a Python Virtual Environment"
source my_venv/bin/activate

echo "installing Python package (numpy) without using the local pip cache — it forces pip to re-download everything fresh."
pip --no-cache-dir install numpy
Loading python 3.11 via module
The following have been reloaded with a version change:
  1) GCCcore/13.2.0 => GCCcore/14.2.0
  2) Python/3.11.5-GCCcore-13.2.0 => Python/3.13.1-GCCcore-14.2.0
  3) SQLite/3.43.1-GCCcore-13.2.0 => SQLite/3.47.2-GCCcore-14.2.0
  4) Tcl/8.6.13-GCCcore-13.2.0 => Tcl/8.6.16-GCCcore-14.2.0
  5) XZ/5.4.4-GCCcore-13.2.0 => XZ/5.6.3-GCCcore-14.2.0
  6) binutils/2.40-GCCcore-13.2.0 => binutils/2.42-GCCcore-14.2.0
  7) bzip2/1.0.8-GCCcore-13.2.0 => bzip2/1.0.8-GCCcore-14.2.0
  8) libffi/3.4.4-GCCcore-13.2.0 => libffi/3.4.5-GCCcore-14.2.0
  9) libreadline/8.2-GCCcore-13.2.0 => libreadline/8.2-GCCcore-14.2.0
 10) ncurses/6.4-GCCcore-13.2.0 => ncurses/6.5-GCCcore-14.2.0
 11) zlib/1.2.13-GCCcore-13.2.0 => zlib/1.3.1-GCCcore-14.2.0
Python3 used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python3
Activating a Python Virtual Environment
installing Python package (numpy) without using the local pip cache — it forces pip to re-download everything fresh.
Requirement already satisfied: numpy in ./my_venv/lib/python3.13/site-packages (2.2.5)

No Cache Usage: Normally, pip caches downloaded packages in ~/.cache/pip/ (Linux/macOS) or %LOCALAPPDATA%\pip\Cache\ (Windows). This speeds up future installations, but –no-cache-dir forces pip to always download fresh copies.

No Cache Storage: The downloaded package files will not be stored in the cache for future use, which can save disk space.

Freezing Dependencies:

After installing packages, freeze the dependencies into a requirements.txt file:

%%bash

# load python 3.13
echo "Loading python 3.11 via module"
module load Python/3.13.1-GCCcore-14.2.0

# print out the found python executable
echo "Python3 used is:"
which python3

echo "Activating a Python Virtual Environment"
source my_venv/bin/activate
echo "installing Python package (numpy) without using the local pip cache — it forces pip to re-download everything fresh."
pip --no-cache-dir install numpy

echo "Saving the exact versions of all installed packages into a file named requirements.txt."
pip freeze > requirements.txt
Loading python 3.11 via module
The following have been reloaded with a version change:
  1) GCCcore/13.2.0 => GCCcore/14.2.0
  2) Python/3.11.5-GCCcore-13.2.0 => Python/3.13.1-GCCcore-14.2.0
  3) SQLite/3.43.1-GCCcore-13.2.0 => SQLite/3.47.2-GCCcore-14.2.0
  4) Tcl/8.6.13-GCCcore-13.2.0 => Tcl/8.6.16-GCCcore-14.2.0
  5) XZ/5.4.4-GCCcore-13.2.0 => XZ/5.6.3-GCCcore-14.2.0
  6) binutils/2.40-GCCcore-13.2.0 => binutils/2.42-GCCcore-14.2.0
  7) bzip2/1.0.8-GCCcore-13.2.0 => bzip2/1.0.8-GCCcore-14.2.0
  8) libffi/3.4.4-GCCcore-13.2.0 => libffi/3.4.5-GCCcore-14.2.0
  9) libreadline/8.2-GCCcore-13.2.0 => libreadline/8.2-GCCcore-14.2.0
 10) ncurses/6.4-GCCcore-13.2.0 => ncurses/6.5-GCCcore-14.2.0
 11) zlib/1.2.13-GCCcore-13.2.0 => zlib/1.3.1-GCCcore-14.2.0
Python3 used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python3
Activating a Python Virtual Environment
installing Python package (numpy) without using the local pip cache — it forces pip to re-download everything fresh.
Requirement already satisfied: numpy in ./my_venv/lib/python3.13/site-packages (2.2.5)
Saving the exact versions of all installed packages into a file named requirements.txt.

While requirement files aren’t strictly needed to create or use a virtual environment, it’s highly recommended to track your project’s dependencies — and requirements.txt is the standard way to do that. The format is simple: a plain list of packages, one per line.

To avoid chaos and potential breakage, you should always specify exact versions for your dependencies. Without this, your code might work today and fail tomorrow because a package was updated. Use version specifiers like ==, >=, and < to lock things down. Many packages also support optional features (called extras) that you can include using square brackets — and for serious reproducibility, don’t forget to add environment markers and Python version constraints. Skipping these details now can mean hours of debugging later.

Deactivating the Virtual Environment:

To deactivate the virtual environment and return to the global Python environment: deactivate

%%bash

# load python 3.13
echo "Loading python 3.11 via module"
module load Python/3.13.1-GCCcore-14.2.0

# print out the found python executable
echo "Python used is:"
which python

echo "Activating a Python Virtual Environment"
source my_venv/bin/activate

echo "deactivating the current virtual environment and return to the default environment."
deactivate
echo "Python used is:"
which python
Loading python 3.11 via module
The following have been reloaded with a version change:
  1) GCCcore/13.2.0 => GCCcore/14.2.0
  2) Python/3.11.5-GCCcore-13.2.0 => Python/3.13.1-GCCcore-14.2.0
  3) SQLite/3.43.1-GCCcore-13.2.0 => SQLite/3.47.2-GCCcore-14.2.0
  4) Tcl/8.6.13-GCCcore-13.2.0 => Tcl/8.6.16-GCCcore-14.2.0
  5) XZ/5.4.4-GCCcore-13.2.0 => XZ/5.6.3-GCCcore-14.2.0
  6) binutils/2.40-GCCcore-13.2.0 => binutils/2.42-GCCcore-14.2.0
  7) bzip2/1.0.8-GCCcore-13.2.0 => bzip2/1.0.8-GCCcore-14.2.0
  8) libffi/3.4.4-GCCcore-13.2.0 => libffi/3.4.5-GCCcore-14.2.0
  9) libreadline/8.2-GCCcore-13.2.0 => libreadline/8.2-GCCcore-14.2.0
 10) ncurses/6.4-GCCcore-13.2.0 => ncurses/6.5-GCCcore-14.2.0
 11) zlib/1.2.13-GCCcore-13.2.0 => zlib/1.3.1-GCCcore-14.2.0
Python used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python
Activating a Python Virtual Environment
deactivating the current virtual environment and return to the default environment.
Python used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python

Version Control:

Include the requirements.txt file in your version control system (e.g., Git) to ensure that all collaborators can recreate the same environment. Ignore the virtual environment directory (e.g., myenv/) to avoid cluttering the repository.

Updating Packages:

Regularly update packages within the virtual environment:

%%bash

# load python 3.13
echo "Loading python 3.11 via module"
module load Python/3.13.1-GCCcore-14.2.0

# print out the found python executable
echo "Python3 used is:"
which python3

echo "Activating a Python Virtual Environment"
source my_venv/bin/activate
echo "installing Python package (numpy) - upgrading the package to the latest available version."
pip install --upgrade numpy
Loading python 3.11 via module
The following have been reloaded with a version change:
  1) GCCcore/13.2.0 => GCCcore/14.2.0
  2) Python/3.11.5-GCCcore-13.2.0 => Python/3.13.1-GCCcore-14.2.0
  3) SQLite/3.43.1-GCCcore-13.2.0 => SQLite/3.47.2-GCCcore-14.2.0
  4) Tcl/8.6.13-GCCcore-13.2.0 => Tcl/8.6.16-GCCcore-14.2.0
  5) XZ/5.4.4-GCCcore-13.2.0 => XZ/5.6.3-GCCcore-14.2.0
  6) binutils/2.40-GCCcore-13.2.0 => binutils/2.42-GCCcore-14.2.0
  7) bzip2/1.0.8-GCCcore-13.2.0 => bzip2/1.0.8-GCCcore-14.2.0
  8) libffi/3.4.4-GCCcore-13.2.0 => libffi/3.4.5-GCCcore-14.2.0
  9) libreadline/8.2-GCCcore-13.2.0 => libreadline/8.2-GCCcore-14.2.0
 10) ncurses/6.4-GCCcore-13.2.0 => ncurses/6.5-GCCcore-14.2.0
 11) zlib/1.2.13-GCCcore-13.2.0 => zlib/1.3.1-GCCcore-14.2.0
Python3 used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python3
Activating a Python Virtual Environment
installing Python package (numpy) - upgrading the package to the latest available version.
Requirement already satisfied: numpy in ./my_venv/lib/python3.13/site-packages (2.2.5)

Cleaning Up:

Periodically clean up unused packages and their dependencies:

%%bash

# load python 3.13
echo "Loading python 3.11 via module"
module load Python/3.13.1-GCCcore-14.2.0

# print out the found python executable
echo "Python3 used is:"
which python3

echo "Activating a Python Virtual Environment"
source my_venv/bin/activate
echo "installing Python package (numpy) - upgrading the package to the latest available version."
pip install --upgrade numpy
which pip
# $ pip freeze | xargs pip uninstall -y # This command pipes the list of installed packages from pip freeze directly to pip uninstall from the cli
pip uninstall -y numpy
Loading python 3.11 via module
The following have been reloaded with a version change:
  1) GCCcore/13.2.0 => GCCcore/14.2.0
  2) Python/3.11.5-GCCcore-13.2.0 => Python/3.13.1-GCCcore-14.2.0
  3) SQLite/3.43.1-GCCcore-13.2.0 => SQLite/3.47.2-GCCcore-14.2.0
  4) Tcl/8.6.13-GCCcore-13.2.0 => Tcl/8.6.16-GCCcore-14.2.0
  5) XZ/5.4.4-GCCcore-13.2.0 => XZ/5.6.3-GCCcore-14.2.0
  6) binutils/2.40-GCCcore-13.2.0 => binutils/2.42-GCCcore-14.2.0
  7) bzip2/1.0.8-GCCcore-13.2.0 => bzip2/1.0.8-GCCcore-14.2.0
  8) libffi/3.4.4-GCCcore-13.2.0 => libffi/3.4.5-GCCcore-14.2.0
  9) libreadline/8.2-GCCcore-13.2.0 => libreadline/8.2-GCCcore-14.2.0
 10) ncurses/6.4-GCCcore-13.2.0 => ncurses/6.5-GCCcore-14.2.0
 11) zlib/1.2.13-GCCcore-13.2.0 => zlib/1.3.1-GCCcore-14.2.0
Python3 used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python3
Activating a Python Virtual Environment
installing Python package (numpy) - upgrading the package to the latest available version.
Requirement already satisfied: numpy in ./my_venv/lib/python3.13/site-packages (2.2.5)
/home/gth/it4i_course/my_venv/bin/pip
Found existing installation: numpy 2.2.5
Uninstalling numpy-2.2.5:
  Successfully uninstalled numpy-2.2.5

Virtualenv

One of the most popular tools for creating virtual environments. Virtualenv is one of the most widely used tools for creating isolated Python environments. It is especially valuable in HPC environments or shared systems, where users often lack administrative privileges to modify system-wide Python installations. By using Virtualenv, developers can install the required dependencies locally, ensuring that projects remain independent and unaffected by global Python configurations.

Key Benefits of Virtualenv:

  • Isolated Environments – Each project gets its own Python environment, avoiding conflicts.

  • Version Flexibility – Easily switch between different Python versions without affecting the system installation.

  • Dependency Management – Install packages specific to a project without interfering with others.

  • Reproducibility – Maintain a clean and structured development setup, ensuring consistency across different environments.

virtualenv and venv are both tools used in Python to create isolated environments for managing dependencies, ensuring that projects do not interfere with each other. While they serve the same purpose, there are some differences in their implementation and history. virtualenv is an external tool that predates venv and was widely used in the Python community before Python 3.3. It provides more features and customization options. On the other hand, venv is a built-in module in Python 3.3 and later versions, and it is a simplified, streamlined version of virtualenv designed to meet the basic needs of creating isolated environments without the need for an external package. Both tools allow you to create an isolated Python environment, install dependencies without affecting the system-wide Python installation, and maintain project-specific configurations. However, virtualenv still supports older Python versions and includes some additional features, like better performance and support for environments in Python 2.

%%bash

rm -rf my_venv  #This would delete the `my_venv` virtual environment folder if it exists
# load python 3.13
echo "Loading python 3.11 via module"
module load Python/3.13.1-GCCcore-14.2.0

# print out the found python executable
echo "Python3 used is:"
which python3

echo " Creating venv 'my_venv' "
pip install --upgrade virtualenv # use --upgrade-deps to automatically update to the latest pip & setuptools versions
virtualenv --version 
virtualenv my_venv # now create a new virtual environment `my_venv`

echo "venv created:"
readlink -f my_venv
echo "Activating a Python Virtual Environment"
source my_venv/bin/activate
which python
Loading python 3.11 via module
The following have been reloaded with a version change:
  1) GCCcore/13.2.0 => GCCcore/14.2.0
  2) Python/3.11.5-GCCcore-13.2.0 => Python/3.13.1-GCCcore-14.2.0
  3) SQLite/3.43.1-GCCcore-13.2.0 => SQLite/3.47.2-GCCcore-14.2.0
  4) Tcl/8.6.13-GCCcore-13.2.0 => Tcl/8.6.16-GCCcore-14.2.0
  5) XZ/5.4.4-GCCcore-13.2.0 => XZ/5.6.3-GCCcore-14.2.0
  6) binutils/2.40-GCCcore-13.2.0 => binutils/2.42-GCCcore-14.2.0
  7) bzip2/1.0.8-GCCcore-13.2.0 => bzip2/1.0.8-GCCcore-14.2.0
  8) libffi/3.4.4-GCCcore-13.2.0 => libffi/3.4.5-GCCcore-14.2.0
  9) libreadline/8.2-GCCcore-13.2.0 => libreadline/8.2-GCCcore-14.2.0
 10) ncurses/6.4-GCCcore-13.2.0 => ncurses/6.5-GCCcore-14.2.0
 11) zlib/1.2.13-GCCcore-13.2.0 => zlib/1.3.1-GCCcore-14.2.0
Python3 used is:
/apps/all/Python/3.13.1-GCCcore-14.2.0/bin/python3
 Creating venv 'my_venv' 
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: virtualenv in /apps/all/virtualenv/20.24.6-GCCcore-13.2.0/lib/python3.11/site-packages (20.24.6)
Collecting virtualenv
  Using cached virtualenv-20.30.0-py3-none-any.whl.metadata (4.5 kB)
Requirement already satisfied: distlib<1,>=0.3.7 in /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages (from virtualenv) (0.3.7)
Requirement already satisfied: filelock<4,>=3.12.2 in /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages (from virtualenv) (3.13.0)
Requirement already satisfied: platformdirs<5,>=3.9.1 in /apps/all/Python-bundle-PyPI/2023.10-GCCcore-13.2.0/lib/python3.11/site-packages (from virtualenv) (3.11.0)
Using cached virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
Installing collected packages: virtualenv
Successfully installed virtualenv-20.30.0
[notice] A new release of pip is available: 24.3.1 -> 25.1
[notice] To update, run: pip install --upgrade pip
virtualenv 20.24.6 from /apps/all/virtualenv/20.24.6-GCCcore-13.2.0/lib/python3.11/site-packages/virtualenv/__init__.py
created virtual environment CPython3.11.11.final.0-64 in 1226ms
  creator CPython3Posix(dest=/home/gth/it4i_course/my_venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/gth/.local/share/virtualenv)
    added seed packages: pip==25.0.1, setuptools==78.1.0, wheel==0.45.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
venv created:
/home/gth/it4i_course/my_venv
Activating a Python Virtual Environment
/home/gth/it4i_course/my_venv/bin/python

Conda

Anaconda and Miniconda are powerful tools that serve as a package manager, environment manager, and distribution of Python, R, and other software packages commonly used in scientific computing, data science, and machine learning. They provide an easy way to manage multiple environments with different dependencies, making it simple to switch between projects without conflicts. Anaconda comes with a large collection of pre-installed packages and tools like Jupyter Notebook, Spyder, and more, while Miniconda offers a minimal installer, allowing users to install only the packages they need. Both support the conda command-line tool to install, update, and manage packages and environments efficiently. Additionally, Anaconda and Miniconda support R and can manage R packages alongside Python packages, making them versatile options for users who work in both languages. You can install Anaconda or Miniconda from their official websites, depending on your preference for a full-featured setup or a lightweight one.

%%bash
ml Anaconda3/2024.02-1
conda config --add channels defaults #the defaults channel when using Conda with the libmamba solver
Warning: 'defaults' already in 'channels' list, moving to the top

The command conda config --add channels defaults adds the defaults channel to your Conda configuration. This is important when using the libmamba solver, ensuring it can access the default Conda repository for package resolution.

%%bash
ml Anaconda3/2024.02-1
conda info | grep "solver :"
                 solver : libmamba (default)

conda init bash vs eval “$(conda shell.bash hook)”

Both conda init bash and eval "$(conda shell.bash hook)" serve the purpose of configuring your shell to work with conda environments, but they operate differently and are suited for different scenarios.

Key Differences

Aspect

conda init bash

eval “$(conda shell.bash hook)”

Purpose

Permanently configures shell initialization files (source: stackoverflow.com)

Temporarily initializes conda for the current session

Scope

System-wide, affects all future shells

Current shell session only

Persistence

Requires shell restart to take effect

Immediate effect, no restart needed

Best Use Case

Interactive shell sessions

Scripts and automation

Changes Made

Modifies shell configuration files

Only sets up environment variables

%%bash
# load Anaconda3
module load Anaconda3/2024.02-1
eval "$(conda shell.bash hook)"

# activate and export the `base` environment
conda activate base
which anaconda
/apps/all/Anaconda3/2024.02-1/bin/anaconda

Activating the Virtual Environment:

Creating a Virtual Environment:

Using Conda:

%%bash

# load Anaconda3
module load Anaconda3/2024.02-1
eval "$(conda shell.bash hook)"

conda create --name my_env -y
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/gth/.conda/envs/my_env




Downloading and Extracting Packages: ...working... done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate my_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

To see a list of all your environments:

%%bash

# load Anaconda3
module load Anaconda3/2024.02-1
conda info --envs
#conda env list
# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

Activating the Virtual Environment:

%%bash
# Load the Anaconda module
module load Anaconda3/2024.02-1

# Initialize conda shell integration
eval "$(conda shell.bash hook)"

# Display information about all available conda environments
conda info --envs

# Activate the conda environment named 'my_env'
conda activate my_env

# Display the path to the Python executable used in the environment
which python

# Display information about all available conda environments again
conda info --envs
# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

/apps/all/Anaconda3/2024.02-1/bin/python

# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env               * /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

After activation, your command line prompt should indicate the active virtual environment.

Installing Packages:

Use pip or conda to install packages within Conda:

pip install package_name

or

%%bash
# Load the Anaconda module
module load Anaconda3/2024.02-1

# Initialize conda shell integration
eval "$(conda shell.bash hook)"

# Display information about all available conda environments
conda info --envs

# Activate the conda environment named 'my_env'
conda activate my_env

# Display the path to the Python executable used in the environment
which python

# Display information about all available conda environments again
conda info --envs

# Install the numpy package in the currently activated environment
conda install numpy

# List all packages installed in the active conda environment
conda list
# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

/apps/all/Anaconda3/2024.02-1/bin/python

# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env               * /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/gth/.conda/envs/my_env

  added / updated specs:
    - numpy


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    numpy-2.2.4                |  py313hf4aebb8_0          11 KB
    python_abi-3.13            |          0_cp313           6 KB
    ------------------------------------------------------------
                                           Total:          17 KB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main 
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu 
  blas               pkgs/main/linux-64::blas-1.0-mkl 
  bzip2              pkgs/main/linux-64::bzip2-1.0.8-h5eee18b_6 
  ca-certificates    pkgs/main/linux-64::ca-certificates-2025.2.25-h06a4308_0 
  expat              pkgs/main/linux-64::expat-2.7.1-h6a678d5_0 
  intel-openmp       pkgs/main/linux-64::intel-openmp-2023.1.0-hdb19cb5_46306 
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.40-h12ee557_0 
  libffi             pkgs/main/linux-64::libffi-3.4.4-h6a678d5_1 
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 
  libgomp            pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 
  libmpdec           pkgs/main/linux-64::libmpdec-4.0.0-h5eee18b_0 
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1 
  libuuid            pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0 
  mkl                pkgs/main/linux-64::mkl-2023.1.0-h213fc3f_46344 
  mkl-service        pkgs/main/linux-64::mkl-service-2.4.0-py313h5eee18b_2 
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.3.11-py313h5eee18b_0 
  mkl_random         pkgs/main/linux-64::mkl_random-1.2.8-py313h06d7b56_0 
  ncurses            pkgs/main/linux-64::ncurses-6.4-h6a678d5_0 
  numpy              pkgs/main/linux-64::numpy-2.2.4-py313hf4aebb8_0 
  numpy-base         pkgs/main/linux-64::numpy-base-2.2.4-py313h3fc9231_0 
  openssl            pkgs/main/linux-64::openssl-3.0.16-h5eee18b_0 
  pip                pkgs/main/linux-64::pip-25.0-py313h06a4308_0 
  python             pkgs/main/linux-64::python-3.13.2-hf623796_100_cp313 
  python_abi         pkgs/main/linux-64::python_abi-3.13-0_cp313 
  readline           pkgs/main/linux-64::readline-8.2-h5eee18b_0 
  setuptools         pkgs/main/linux-64::setuptools-72.1.0-py313h06a4308_0 
  sqlite             pkgs/main/linux-64::sqlite-3.45.3-h5eee18b_0 
  tbb                pkgs/main/linux-64::tbb-2021.8.0-hdb19cb5_0 
  tk                 pkgs/main/linux-64::tk-8.6.14-h39e8969_0 
  tzdata             pkgs/main/noarch::tzdata-2025a-h04d1e81_0 
  wheel              pkgs/main/linux-64::wheel-0.45.1-py313h06a4308_0 
  xz                 pkgs/main/linux-64::xz-5.6.4-h5eee18b_1 
  zlib               pkgs/main/linux-64::zlib-1.2.13-h5eee18b_1 


Proceed ([y]/n)? 

numpy-2.2.4          | 11 KB     |            |   0% 
numpy-2.2.4          | 11 KB     | ########## | 100% 
numpy-2.2.4          | 11 KB     | ########## | 100% 
python_abi-3.13      | 6 KB      | ########## | 100% 
                                                     
                                                      done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Freezing Dependencies:

Conda automatically manages dependencies in its environment and does not require a separate requirements.txt file.

%%bash
module load Anaconda3/2024.02-1
eval "$(conda shell.bash hook)"
conda info --envs
conda activate my_env
conda info --envs
conda list -e > conda_requirements.txt # Save a list of all installed packages in the current environment to a file (conda_requirements.txt)
# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app


# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env               * /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

Deactivating the Virtual Environment:

To deactivate the virtual environment and return to the global Python environment:

%%bash
# Load the Anaconda module
module load Anaconda3/2024.02-1

# Initialize conda shell integration
eval "$(conda shell.bash hook)"

# Display information about all available conda environments
conda info --envs

# Activate the conda environment named 'my_env'
conda activate my_env

# Display the path to the Python executable used in the environment
which python

# Display information about all available conda environments again
conda info --envs

# Deactivate the currently active conda environment
conda deactivate

# Display information about all available conda environments after deactivation
conda info --envs
# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

/home/gth/.conda/envs/my_env/bin/python

# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env               * /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app


# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

Version Control:

Include the requirements.txt file or environment.yml file in your version control system (e.g., Git) to ensure that all collaborators can recreate the same environment. Ignore the virtual environment directory (e.g., myenv/) to avoid cluttering the repository.

Updating Packages:

Regularly update packages within the virtual environment:
conda update package_name.

%%bash
module load Anaconda3/2024.02-1
eval "$(conda shell.bash hook)"
conda info --envs
conda activate my_env
conda update numpy # Update the 'numpy' package in the currently active environment to the latest version
conda list
# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

# All requested packages already installed.

# packages in environment at /home/gth/.conda/envs/my_env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             5.1                       1_gnu  
blas                      1.0                         mkl  
bzip2                     1.0.8                h5eee18b_6  
ca-certificates           2025.2.25            h06a4308_0  
expat                     2.7.1                h6a678d5_0  
intel-openmp              2023.1.0         hdb19cb5_46306  
ld_impl_linux-64          2.40                 h12ee557_0  
libffi                    3.4.4                h6a678d5_1  
libgcc-ng                 11.2.0               h1234567_1  
libgomp                   11.2.0               h1234567_1  
libmpdec                  4.0.0                h5eee18b_0  
libstdcxx-ng              11.2.0               h1234567_1  
libuuid                   1.41.5               h5eee18b_0  
mkl                       2023.1.0         h213fc3f_46344  
mkl-service               2.4.0           py313h5eee18b_2  
mkl_fft                   1.3.11          py313h5eee18b_0  
mkl_random                1.2.8           py313h06d7b56_0  
ncurses                   6.4                  h6a678d5_0  
numpy                     2.2.4           py313hf4aebb8_0  
numpy-base                2.2.4           py313h3fc9231_0  
openssl                   3.0.16               h5eee18b_0  
pip                       25.0            py313h06a4308_0  
python                    3.13.2          hf623796_100_cp313  
python_abi                3.13                    0_cp313  
readline                  8.2                  h5eee18b_0  
setuptools                72.1.0          py313h06a4308_0  
sqlite                    3.45.3               h5eee18b_0  
tbb                       2021.8.0             hdb19cb5_0  
tk                        8.6.14               h39e8969_0  
tzdata                    2025a                h04d1e81_0  
wheel                     0.45.1          py313h06a4308_0  
xz                        5.6.4                h5eee18b_1  
zlib                      1.2.13               h5eee18b_1  

Cleaning Up:

conda clean --all This command only clears temporary and cache files.

%%bash
module load Anaconda3/2024.02-1
eval "$(conda shell.bash hook)"
conda activate my_env
which python
conda info --envs
conda clean --all -y # Clean up unused packages and cache from the conda environment
/home/gth/.conda/envs/my_env/bin/python

# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env               * /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

Will remove 46 (101.4 MB) tarball(s).
Will remove 1 index cache(s).
Will remove 8 (318 KB) package(s).
There are no tempfile(s) to remove.
There are no logfile(s) to remove.

Command

Effect

conda clean --all

Remove temp/cached files only 🚮

conda remove <package>

Uninstall specific package(s) 📦

conda env remove -n <name>

Delete entire environment 🔥

practical examples of the requirements.txt file

%%writefile requirements.txt

requests>=2.26.0         # A library for making HTTP requests
numpy>=1.21.0,<2.0.0     # A library for numerical computing in Python
pandas==1.5.3            # A library for data manipulation and analysis
matplotlib               # A plotting library for creating visualizations
scipy>=1.7.0             # A library for scientific and technical computing
pytest>=7.0.0            # A testing framework for writing and running tests
Overwriting requirements.txt
%%bash
ml purge # Unloads all currently loaded modules 
ml list # lists currently loaded modules
ml Anaconda3/2024.02-1
conda env list
# Create a new conda environment named 'req_env' using the specified requirements file ('requirements.txt')
conda create --name req_env --file requirements.txt -y 
conda env list
conda list -e > conda_requirements.txt # Save a list of all installed packages in the current environment to a file (conda_requirements.txt)
The following modules were not unloaded:
  (Use "module --force purge" to unload all):

  1) XALT/3.0.2

Currently Loaded Modules:
  1) XALT/3.0.2 (S)

  Where:
   S:  Module is Sticky, requires --force to unload or purge

 
# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app

Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/gth/.conda/envs/req_env

  added / updated specs:
    - matplotlib
    - numpy[version='>=1.21.0,<2.0.0']
    - pandas==1.5.3
    - pytest[version='>=7.0.0']
    - requests[version='>=2.26.0']
    - scipy[version='>=1.7.0']


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |             main           3 KB
    _openmp_mutex-5.1          |            1_gnu          21 KB
    blas-1.0                   |              mkl           6 KB
    libgfortran-ng-11.2.0      |       h00389a5_1          20 KB
    matplotlib-3.10.0          |  py311h06a4308_0           7 KB
    numpy-1.26.4               |  py311h08b1b3b_0          10 KB
    ------------------------------------------------------------
                                           Total:          67 KB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main 
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu 
  blas               pkgs/main/linux-64::blas-1.0-mkl 
  bottleneck         pkgs/main/linux-64::bottleneck-1.4.2-py311hf4808d0_0 
  brotli-python      pkgs/main/linux-64::brotli-python-1.0.9-py311h6a678d5_9 
  bzip2              pkgs/main/linux-64::bzip2-1.0.8-h5eee18b_6 
  c-ares             pkgs/main/linux-64::c-ares-1.19.1-h5eee18b_0 
  ca-certificates    pkgs/main/linux-64::ca-certificates-2025.2.25-h06a4308_0 
  certifi            pkgs/main/linux-64::certifi-2025.1.31-py311h06a4308_0 
  charset-normalizer pkgs/main/noarch::charset-normalizer-3.3.2-pyhd3eb1b0_0 
  contourpy          pkgs/main/linux-64::contourpy-1.3.1-py311hdb19cb5_0 
  cycler             pkgs/main/noarch::cycler-0.11.0-pyhd3eb1b0_0 
  cyrus-sasl         pkgs/main/linux-64::cyrus-sasl-2.1.28-h52b45da_1 
  expat              pkgs/main/linux-64::expat-2.7.1-h6a678d5_0 
  fontconfig         pkgs/main/linux-64::fontconfig-2.14.1-h55d465d_3 
  fonttools          pkgs/main/linux-64::fonttools-4.55.3-py311h5eee18b_0 
  freetype           pkgs/main/linux-64::freetype-2.13.3-h4a9f257_0 
  icu                pkgs/main/linux-64::icu-73.1-h6a678d5_0 
  idna               pkgs/main/linux-64::idna-3.7-py311h06a4308_0 
  iniconfig          pkgs/main/noarch::iniconfig-1.1.1-pyhd3eb1b0_0 
  intel-openmp       pkgs/main/linux-64::intel-openmp-2023.1.0-hdb19cb5_46306 
  jpeg               pkgs/main/linux-64::jpeg-9e-h5eee18b_3 
  kiwisolver         pkgs/main/linux-64::kiwisolver-1.4.8-py311h6a678d5_0 
  krb5               pkgs/main/linux-64::krb5-1.20.1-h143b758_1 
  lcms2              pkgs/main/linux-64::lcms2-2.16-h92b89f2_1 
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.40-h12ee557_0 
  lerc               pkgs/main/linux-64::lerc-4.0.0-h6a678d5_0 
  libabseil          pkgs/main/linux-64::libabseil-20250127.0-cxx17_h6a678d5_0 
  libcups            pkgs/main/linux-64::libcups-2.4.2-h2d74bed_1 
  libcurl            pkgs/main/linux-64::libcurl-8.12.1-hc9e6f67_0 
  libdeflate         pkgs/main/linux-64::libdeflate-1.22-h5eee18b_0 
  libedit            pkgs/main/linux-64::libedit-3.1.20230828-h5eee18b_0 
  libev              pkgs/main/linux-64::libev-4.33-h7f8727e_1 
  libffi             pkgs/main/linux-64::libffi-3.4.4-h6a678d5_1 
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 
  libgfortran-ng     pkgs/main/linux-64::libgfortran-ng-11.2.0-h00389a5_1 
  libgfortran5       pkgs/main/linux-64::libgfortran5-11.2.0-h1234567_1 
  libglib            pkgs/main/linux-64::libglib-2.78.4-hdc74915_0 
  libgomp            pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 
  libiconv           pkgs/main/linux-64::libiconv-1.16-h5eee18b_3 
  libnghttp2         pkgs/main/linux-64::libnghttp2-1.57.0-h2d74bed_0 
  libpng             pkgs/main/linux-64::libpng-1.6.39-h5eee18b_0 
  libpq              pkgs/main/linux-64::libpq-17.4-hdbd6064_0 
  libprotobuf        pkgs/main/linux-64::libprotobuf-5.29.3-hc99497a_0 
  libssh2            pkgs/main/linux-64::libssh2-1.11.1-h251f7ec_0 
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1 
  libtiff            pkgs/main/linux-64::libtiff-4.7.0-hde9077f_0 
  libuuid            pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0 
  libwebp-base       pkgs/main/linux-64::libwebp-base-1.3.2-h5eee18b_1 
  libxcb             pkgs/main/linux-64::libxcb-1.15-h7f8727e_0 
  libxkbcommon       pkgs/main/linux-64::libxkbcommon-1.0.1-h097e994_2 
  libxml2            pkgs/main/linux-64::libxml2-2.13.7-hfdd30dd_0 
  lz4-c              pkgs/main/linux-64::lz4-c-1.9.4-h6a678d5_1 
  matplotlib         pkgs/main/linux-64::matplotlib-3.10.0-py311h06a4308_0 
  matplotlib-base    pkgs/main/linux-64::matplotlib-base-3.10.0-py311hbfdbfaf_0 
  mkl                pkgs/main/linux-64::mkl-2023.1.0-h213fc3f_46344 
  mkl-service        pkgs/main/linux-64::mkl-service-2.4.0-py311h5eee18b_2 
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.3.11-py311h5eee18b_0 
  mkl_random         pkgs/main/linux-64::mkl_random-1.2.8-py311ha02d727_0 
  mysql              pkgs/main/linux-64::mysql-8.4.0-h721767e_2 
  ncurses            pkgs/main/linux-64::ncurses-6.4-h6a678d5_0 
  numexpr            pkgs/main/linux-64::numexpr-2.10.1-py311h3c60e43_0 
  numpy              pkgs/main/linux-64::numpy-1.26.4-py311h08b1b3b_0 
  numpy-base         pkgs/main/linux-64::numpy-base-1.26.4-py311hf175353_0 
  openjpeg           pkgs/main/linux-64::openjpeg-2.5.2-h0d4d230_1 
  openldap           pkgs/main/linux-64::openldap-2.6.4-h42fbc30_0 
  openssl            pkgs/main/linux-64::openssl-3.0.16-h5eee18b_0 
  packaging          pkgs/main/linux-64::packaging-24.2-py311h06a4308_0 
  pandas             pkgs/main/linux-64::pandas-1.5.3-py311hba01205_0 
  pcre2              pkgs/main/linux-64::pcre2-10.42-hebb0a14_1 
  pillow             pkgs/main/linux-64::pillow-11.1.0-py311hac6e08b_1 
  pip                pkgs/main/linux-64::pip-25.0-py311h06a4308_0 
  pluggy             pkgs/main/linux-64::pluggy-1.5.0-py311h06a4308_0 
  pyparsing          pkgs/main/linux-64::pyparsing-3.2.0-py311h06a4308_0 
  pyqt               pkgs/main/linux-64::pyqt-6.7.1-py311h6a678d5_1 
  pyqt6-sip          pkgs/main/linux-64::pyqt6-sip-13.9.1-py311h5eee18b_1 
  pysocks            pkgs/main/linux-64::pysocks-1.7.1-py311h06a4308_0 
  pytest             pkgs/main/linux-64::pytest-8.3.4-py311h06a4308_0 
  python             pkgs/main/linux-64::python-3.11.11-he870216_0 
  python-dateutil    pkgs/main/linux-64::python-dateutil-2.9.0post0-py311h06a4308_2 
  pytz               pkgs/main/linux-64::pytz-2024.1-py311h06a4308_0 
  qtbase             pkgs/main/linux-64::qtbase-6.7.3-hdaa5aa8_0 
  qtdeclarative      pkgs/main/linux-64::qtdeclarative-6.7.3-h6a678d5_0 
  qtsvg              pkgs/main/linux-64::qtsvg-6.7.3-he621ea3_0 
  qttools            pkgs/main/linux-64::qttools-6.7.3-h80c7b02_0 
  qtwebchannel       pkgs/main/linux-64::qtwebchannel-6.7.3-h6a678d5_0 
  qtwebsockets       pkgs/main/linux-64::qtwebsockets-6.7.3-h6a678d5_0 
  readline           pkgs/main/linux-64::readline-8.2-h5eee18b_0 
  requests           pkgs/main/linux-64::requests-2.32.3-py311h06a4308_1 
  scipy              pkgs/main/linux-64::scipy-1.15.2-py311h23a989f_1 
  setuptools         pkgs/main/linux-64::setuptools-75.8.0-py311h06a4308_0 
  sip                pkgs/main/linux-64::sip-6.10.0-py311h6a678d5_0 
  six                pkgs/main/linux-64::six-1.17.0-py311h06a4308_0 
  sqlite             pkgs/main/linux-64::sqlite-3.45.3-h5eee18b_0 
  tbb                pkgs/main/linux-64::tbb-2021.8.0-hdb19cb5_0 
  tk                 pkgs/main/linux-64::tk-8.6.14-h39e8969_0 
  tornado            pkgs/main/linux-64::tornado-6.4.2-py311h5eee18b_0 
  tzdata             pkgs/main/noarch::tzdata-2025a-h04d1e81_0 
  unicodedata2       pkgs/main/linux-64::unicodedata2-15.1.0-py311h5eee18b_1 
  urllib3            pkgs/main/linux-64::urllib3-2.3.0-py311h06a4308_0 
  wheel              pkgs/main/linux-64::wheel-0.45.1-py311h06a4308_0 
  xcb-util-cursor    pkgs/main/linux-64::xcb-util-cursor-0.1.4-h5eee18b_0 
  xz                 pkgs/main/linux-64::xz-5.6.4-h5eee18b_1 
  zlib               pkgs/main/linux-64::zlib-1.2.13-h5eee18b_1 
  zstd               pkgs/main/linux-64::zstd-1.5.6-hc292b87_0 



_openmp_mutex-5.1    | 21 KB     |            |   0% 
libgfortran-ng-11.2. | 20 KB     |            |   0% 

numpy-1.26.4         | 10 KB     |            |   0% 


matplotlib-3.10.0    | 7 KB      |            |   0% 



blas-1.0             | 6 KB      |            |   0% 




_openmp_mutex-5.1    | 21 KB     | ########## | 100% 



blas-1.0             | 6 KB      | ########## | 100% 


matplotlib-3.10.0    | 7 KB      | ########## | 100% 
libgfortran-ng-11.2. | 20 KB     | ########1  |  81% 



blas-1.0             | 6 KB      | ########## | 100% 


matplotlib-3.10.0    | 7 KB      | ########## | 100% 

numpy-1.26.4         | 10 KB     | ########## | 100% 
libgfortran-ng-11.2. | 20 KB     | ########## | 100% 

numpy-1.26.4         | 10 KB     | ########## | 100% 




_libgcc_mutex-0.1    | 3 KB      | ########## | 100% 




_libgcc_mutex-0.1    | 3 KB      | ########## | 100% 



blas-1.0             | 6 KB      | ########## | 100% 


matplotlib-3.10.0    | 7 KB      | ########## | 100% 

numpy-1.26.4         | 10 KB     | ########## | 100% 




_openmp_mutex-5.1    | 21 KB     | ########## | 100% 
                                                     
                                                     

                                                     


                                                     



                                                     




                                                      done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate req_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate


# conda environments:
#
base                   /apps/all/Anaconda3/2024.02-1
my-first-conda-env     /home/gth/.conda/envs/my-first-conda-env
my_env                 /home/gth/.conda/envs/my_env
req_env                /home/gth/.conda/envs/req_env
venv-app               /home/gth/.conda/envs/venv-app