Missing Python Modules
The MCUXpresso extension for VS Code uses some Python modules, and uses dozens of modules when developing for Zephyr. The MCUXpresso Installer will install the dependency modules needed for these tools. However, if errors occur when running the Installer, or while building a Zephyr application, a possible reason is missing Python module(s). A potential reason why a module was not installed could be Issues with multiple Python versions installed. These Python modules can also be installed manually using CLI.
The MCUXpresso Installer will check if a Python version is already installed, and will install Python if needed. Then it creates a Python Virtual Environment used by VS Code, and tries to install pip into that Virtual Environment (VE). If pip is missing, or fails to install, you can install it manually using this command. First activate the VE, and then command using the path to the VE. If needed, open the command window with Administrator rights. This command installs pip with the default VE path in Windows:
C:\Users\<username>\.mcuxpressotools\.venv\Scripts\python.exe -m ensurepip --upgrade
Another Python module needed is West. If West is missing, this typically causes errors while importing a repository, which runs the `west init` command. You can also use CLI to verify if a Python module is installed in a specific Python version. This command checks if West is installed, and reports the version if it is:
C:\Users\<username>\.mcuxpressotools\.venv\Scripts\python.exe -m west --version
Similar to the above steps installing pip, you can manually install west:
C:\Users\<username>\.mcuxpressotools\.venv\Scripts\python.exe -m pip install west --upgrade
When developing with Zephyr, dozens more Python modules are required. Some of these modules are used when building a Zephyr application. The Zephyr repo provides this requirements.txt, which provides a list of modules for pip to install. If VS Code fails to build an app and gives an error of a missing Python module, you can use the steps above to manually install a single Python module. But if 1 module is missing, likely there are more missing. You can install all the required modules with this pip command. This is done after the Zephyr repo is imported/cloned, and requires the path to the local Zephyr repo. The command below uses the default repo path when imported in Windows:
C:\Users\<username>\.mcuxpressotools\.venv\Scripts\python.exe -m pip install -r C:\Users\<username>\zephyrproject\zephyr\scripts\requirements.txt