From 00cc5e1a8c7b90165c27c043efb2b7ff92f9022f Mon Sep 17 00:00:00 2001
From: Alexander Grund <alexander.grund@tu-dresden.de>
Date: Mon, 30 Sep 2024 14:27:37 +0200
Subject: [PATCH] Document the requirement to use a virtualenv to install
 Python packages

All `Python` modules now export `PIP_REQUIRE_VIRTUALENV=true`.
This causes an error when users try to use `pip install` without an
active virtualenv.
This also avoids admins accidentally installing/changing Python packages
in the global module.
---
 doc.zih.tu-dresden.de/docs/quickstart/getting_started.md | 5 ++++-
 .../docs/software/python_virtual_environments.md         | 9 ++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/doc.zih.tu-dresden.de/docs/quickstart/getting_started.md b/doc.zih.tu-dresden.de/docs/quickstart/getting_started.md
index e734374e2..579eb2cd9 100644
--- a/doc.zih.tu-dresden.de/docs/quickstart/getting_started.md
+++ b/doc.zih.tu-dresden.de/docs/quickstart/getting_started.md
@@ -386,7 +386,10 @@ For additional information refer to the detailed documentation on [modules](../s
 !!! hint "Tip for Python packages"
 
     The use of [Virtual Environments](../software/python_virtual_environments.md)
-    (best in [workspaces](../data_lifecycle/workspaces.md)) is recommended.
+    (best in [workspaces](../data_lifecycle/workspaces.md)) is required if you want to install
+    additional Python Packages with `pip`.
+    When using `pip install` without an activated virtualenv you will get this error:
+    > ERROR: Could not find an activated virtualenv (required).
 
     Please check the module system, even for specific Python packages,
     e.g. `numpy`, `tensorflow` or `pytorch`.
diff --git a/doc.zih.tu-dresden.de/docs/software/python_virtual_environments.md b/doc.zih.tu-dresden.de/docs/software/python_virtual_environments.md
index 5c4759850..d4ed4ae62 100644
--- a/doc.zih.tu-dresden.de/docs/software/python_virtual_environments.md
+++ b/doc.zih.tu-dresden.de/docs/software/python_virtual_environments.md
@@ -5,7 +5,14 @@ create an isolated run-time environment. We recommend using `virtualenv` for
 this purpose. In your virtual environment, you can use packages from the
 [modules list](modules.md) or if you didn't find what you need you can install
 required packages with the command: `pip install`. With the command
-`pip freeze`, you can see a list of all installed packages and their versions.
+`pip list`, you can see a list of all installed packages and their versions.
+
+!!! warning
+
+    Note that you cannot install additional Python Packages with `pip`
+    without an activated virtualenv on our systems.
+    Doing so will abort with the following error error:
+    > ERROR: Could not find an activated virtualenv (required).
 
 There are two methods of how to work with virtual environments on ZIH systems:
 
-- 
GitLab