Check Python version on application launch (#393)

* Check that the minimum required Python (3.8) version is used.

Prints a descriptive error message, rather than a cryptic import
failure, if minimum Python version is not met.

Internal ticket SWDEV-477233.


* Disable the RPM mangling of shebangs.

The are changing the `#!/usr/bin/python3` to `#!/usr/libexec/platform-python`.
With this set, omniperf is always using the platform installed version
of python, which is python 3.6 on RHEL 8. Using virtual environments,
like conda, did not work.

* Fix pylint issues

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>
此提交包含在:
David Galiffi
2024-08-09 15:02:51 -04:00
提交者 coleramos425
父節點 b385b1230c
當前提交 75a4b51d0d
共有 3 個檔案被更改,包括 51 行新增19 行删除
+20 -4
查看文件
@@ -32,7 +32,7 @@ right for you.
:width: 800
.. _core-install:
Core installation
=================
@@ -44,6 +44,12 @@ installation.
* CMake ``>= 3.19``
* ROCm ``>= 5.7.1``
.. note::
Omniperf will use the first version of ``Python3`` found in your system's
``PATH``. If the default version of Python3 is older than 3.8, you may need to
update your system's ``PATH`` to point to a newer version of Python3.
Omniperf depends on a number of Python packages documented in the top-level
``requirements.txt`` file. Install these *before* configuring Omniperf.
@@ -66,6 +72,16 @@ following steps illustrate how to install the necessary Python dependencies
using `pip <https://packaging.python.org/en/latest/>`_ and Omniperf into a
shared location controlled by the ``INSTALL_DIR`` environment variable.
.. tip::
To always run Omniperf with a particular version of python, you can create a
bash alias. For example, to run Omniperf with Python 3.10, you can run the
following command:
.. code-block:: shell
alias omniperf-mypython="/usr/bin/python3.10 /opt/rocm/bin/omniperf"
.. _core-install-cmake-vars:
Configuration variables
@@ -208,21 +224,21 @@ software stack.
.. code-block:: shell
$ sudo apt install omniperf
$ pip install -r /opt/rocm/libexec/omniperf/requirements.txt
$ python3 -m pip install -r /opt/rocm/libexec/omniperf/requirements.txt
.. tab-item:: Red Hat Enterprise Linux
.. code-block:: shell
$ sudo dnf install omniperf
$ pip install -r /opt/rocm/libexec/omniperf/requirements.txt
$ python3 -m pip install -r /opt/rocm/libexec/omniperf/requirements.txt
.. tab-item:: SUSE Linux Enterprise Server
.. code-block:: shell
$ sudo zypper install omniperf
$ pip install -r /opt/rocm/libexec/omniperf/requirements.txt
$ python3 -m pip install -r /opt/rocm/libexec/omniperf/requirements.txt
.. _core-install-rocprof-var: