Skip to content

Commit f5734ff

Browse files
committed
installation: Do not use virtualenv tool
The 'virtualenv' tool does not seem to be available in RHEL 9, but 'python3 -m venv' works there. Switch installation to use 'python3 -m venv' for all distros, it should work everywhere. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
1 parent b71e03c commit f5734ff

5 files changed

Lines changed: 33 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Versioning practices: [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
55

66
## [ADD NEW VERSION HERE] - ADD DATE HERE
77
### Fixed
8+
- Fix installation on RHEL.
89
### Added
910
### Removed
1011
### Changed

docs/guide-install.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,19 @@ your system.
152152

153153
**Tools needed for installation:**
154154

155-
- `pip3` and `virtualenv`: required for `pip`-based installation
156-
(see [Installation Using pip](#installation-using-pip)).
157-
- `uv`: an alternative to `pip3` + `virtualenv` (see [Using uv](#using-uv)). Install one or the other.
155+
- `pip3` and `python3 -m venv`: required for `pip`-based installation
156+
(see [Installation Using pip](#installation-using-pip)). On Ubuntu/Debian, `python3 -m venv`
157+
requires the `python3-venv` package; the installer will install it automatically if missing.
158+
- `uv`: an alternative to `pip3` + `python3 -m venv` (see [Using uv](#using-uv)). Install one or the other.
158159
- `rsync`: used to copy sources to a temporary directory during installation from a local path.
159160

160161
The commands below install the `pip3`-based tools. If you prefer `uv`, install it instead and skip
161-
`python3-pip` and `python3-virtualenv`.
162+
`python3-pip`.
162163

163-
**Fedora / CentOS**
164+
**Fedora / RHEL / CentOS**
164165

165166
```bash
166-
sudo dnf install -y util-linux kmod python3-pip python3-virtualenv rsync
167+
sudo dnf install -y util-linux kmod python3-pip rsync
167168
```
168169

169170
**Ubuntu**

pepclibs/helperlibs/ToolChecker.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"xargs": "findutils",
5656
}
5757

58-
# CentOS, Fedora, RHEL.
58+
# Fedora.
5959
_FEDORA_PKGINFO: Final[dict[str, str]] = {
6060
**_COMMON_PKGINFO,
6161
"tc": "iproute-tc",
@@ -69,6 +69,19 @@
6969
"virtualenv": "python3-virtualenv",
7070
}
7171

72+
# CentOS, RHEL.
73+
_RHEL_PKGINFO: Final[dict[str, str]] = {
74+
**_COMMON_PKGINFO,
75+
"tc": "iproute-tc",
76+
"bpftool": "bpftool",
77+
"libbpf": "libbpf-devel",
78+
"kill": "util-linux",
79+
"pgrep": "procps-ng",
80+
"pkill": "procps-ng",
81+
"ps": "procps-ng",
82+
"sch_etf.ko": "kernel-modules-extra",
83+
}
84+
7285
# Ubuntu.
7386
_UBUNTU_PKGINFO: Final[dict[str, str]] = {
7487
**_COMMON_PKGINFO,
@@ -102,8 +115,8 @@
102115
#
103116
_PKGINFO: Final[dict[str, dict[str, str]]] = {
104117
"fedora": _FEDORA_PKGINFO,
105-
"centos": _FEDORA_PKGINFO,
106-
"rhel": _FEDORA_PKGINFO,
118+
"centos": _RHEL_PKGINFO,
119+
"rhel": _RHEL_PKGINFO,
107120
"ubuntu": _UBUNTU_PKGINFO,
108121
"debian": _DEBIAN_PKGINFO,
109122
}

pepctools/InstallPepc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ class _CmdlineArgsTypedDict(SSHArgsTypedDict, total=False):
6969

7070
# The tools pepc relies on to be installed and to operate.
7171
PEPC_DEPENDENCIES: Final[tuple[str, ...]] = (
72-
"virtualenv",
7372
"pip3",
7473
"cat",
7574
"dmesg",

pepctools/PythonPrjInstaller.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ def install_dependencies(self, dependencies: Sequence[str]):
173173

174174
with ToolChecker.ToolChecker(self._pman) as tchk:
175175
tchk.ensure_tools_available(tuple(tools))
176+
# Verify that 'python3 -m venv' works. On Ubuntu/Debian it requires the 'python3-venv'
177+
# OS package and is not available by default. Install it if the test fails.
178+
venv_test_dir = self._pman.mkdtemp(prefix=f"{self._prjname}-venv-test-")
179+
try:
180+
_, _, exitcode = self._pman.run(f"python3 -m venv '{venv_test_dir}/testvenv'")
181+
finally:
182+
self._pman.rmtree(venv_test_dir)
183+
if exitcode != 0:
184+
tchk.ensure_tools_available(("virtualenv",))
176185

177186
def _run_installation(self, src_path: Path | None):
178187
"""

0 commit comments

Comments
 (0)