doc: getting_started: remove global Python setup

As it was already outlined, installing Python dependencies at a system
level or user level can be dangerous. For this reason, the default setup
instructions already pointed users to use Python virtual environments. On
newer Ubuntu installations (23.04 onwards) system-level pip installs are
not allowed. Let's make Zephyr _Python-safe_ as well by removing dangerous
instructions.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2024-07-15 16:06:13 +02:00 committed by Carles Cufí
commit 33d92b4acd

View file

@ -207,28 +207,14 @@ Get Zephyr and install Python dependencies
Next, clone Zephyr and its :ref:`modules <modules>` into a new :ref:`west
<west>` workspace named :file:`zephyrproject`. You'll also install Zephyr's
additional Python dependencies.
additional Python dependencies in a `Python virtual environment`_.
.. note::
It is easy to run into Python package incompatibilities when installing
dependencies at a system or user level. This situation can happen,
for example, if working on multiple Zephyr versions or other projects
using Python on the same machine.
For this reason it is suggested to use `Python virtual environments`_.
.. _Python virtual environments: https://docs.python.org/3/library/venv.html
.. _Python virtual environment: https://docs.python.org/3/library/venv.html
.. tabs::
.. group-tab:: Ubuntu
.. tabs::
.. group-tab:: Install within virtual environment
#. Use ``apt`` to install Python ``venv`` package:
.. code-block:: bash
@ -285,46 +271,8 @@ additional Python dependencies.
pip install -r ~/zephyrproject/zephyr/scripts/requirements.txt
.. group-tab:: Install globally
#. Install west, and make sure :file:`~/.local/bin` is on your
:envvar:`PATH` :ref:`environment variable <env_vars>`:
.. code-block:: bash
pip3 install --user -U west
echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc
source ~/.bashrc
#. Get the Zephyr source code:
.. code-block:: bash
west init ~/zephyrproject
cd ~/zephyrproject
west update
#. Export a :ref:`Zephyr CMake package <cmake_pkg>`. This allows CMake to
automatically load boilerplate code required for building Zephyr
applications.
.. code-block:: bash
west zephyr-export
#. Zephyr's ``scripts/requirements.txt`` file declares additional Python
dependencies. Install them with ``pip3``.
.. code-block:: bash
pip3 install --user -r ~/zephyrproject/zephyr/scripts/requirements.txt
.. group-tab:: macOS
.. tabs::
.. group-tab:: Install within virtual environment
#. Create a new virtual environment:
.. code-block:: bash
@ -375,43 +323,8 @@ additional Python dependencies.
pip install -r ~/zephyrproject/zephyr/scripts/requirements.txt
.. group-tab:: Install globally
#. Install west:
.. code-block:: bash
pip3 install -U west
#. Get the Zephyr source code:
.. code-block:: bash
west init ~/zephyrproject
cd ~/zephyrproject
west update
#. Export a :ref:`Zephyr CMake package <cmake_pkg>`. This allows CMake to
automatically load boilerplate code required for building Zephyr
applications.
.. code-block:: bash
west zephyr-export
#. Zephyr's ``scripts/requirements.txt`` file declares additional Python
dependencies. Install them with ``pip3``.
.. code-block:: bash
pip3 install -r ~/zephyrproject/zephyr/scripts/requirements.txt
.. group-tab:: Windows
.. tabs::
.. group-tab:: Install within virtual environment
#. Open a ``cmd.exe`` terminal window **as a regular user**
#. Create a new virtual environment:
@ -465,41 +378,6 @@ additional Python dependencies.
pip install -r %HOMEPATH%\zephyrproject\zephyr\scripts\requirements.txt
.. group-tab:: Install globally
#. Open a ``cmd.exe`` terminal window **as a regular user**
#. Install west:
.. code-block:: bat
pip3 install -U west
#. Get the Zephyr source code:
.. code-block:: bat
cd %HOMEPATH%
west init zephyrproject
cd zephyrproject
west update
#. Export a :ref:`Zephyr CMake package <cmake_pkg>`. This allows CMake to
automatically load boilerplate code required for building Zephyr
applications.
.. code-block:: bat
west zephyr-export
#. Zephyr's ``scripts\requirements.txt`` file declares additional Python
dependencies. Install them with ``pip3``.
.. code-block:: bat
pip3 install -r %HOMEPATH%\zephyrproject\zephyr\scripts\requirements.txt
Install the Zephyr SDK
**********************