If you encounter problems importing or building mbed projects, please try resetting your Python environment as shown on this page.
- Clear the Tools->Options->VisualGDB->General->Tools->Python Directory setting:
- Delete the %LOCALAPPDATA%\VisualGDB\Python* directories.
- Restart Visual Studio and open the Mbed Project Wizard. When prompted to install Python, try installing the latest Python 3:This will install a version of Python that was tested with mbed scripts on our side, and it should work exactly as described in our mbed tutorials.
- If you still get an error while trying to clone an mbed repository, the selected mbed version might be referencing packages that are not available in the currently used Python version. If this happens, click the “Show output from failed command” link in the error message shown by VisualGDB:The log will contain output similar to the one shown below:
12345678910Run "C:\Users\virtual.SYSPROGS\AppData\Local\VisualGDB\Python3\python.exe "C:\Users\virtual.SYSPROGS\AppData\Local\VisualGDB\Python3\lib\site-packages\mbed\mbed.py" update mbed-os-6.9.0" in directory "c:\projects\temp\MbedProject2\mbed-os" on local computer--------------------------Requirement already satisfied: colorama==0.3.9 in c:\users\virtual.sysprogs\appdata\local\visualgdb\python3\lib\site-packages (from -r c:\projects\temp\MbedProject2\mbed-os\requirements.txt (line 1)) (0.3.9)<...>ERROR: Could not find a version that satisfies the requirement pywin32==224 (from versions: 225, 226, 227, 228, 300, 301, 302)ERROR: No matching distribution found for pywin32==224WARNING: You are using pip version 21.1.1; however, version 21.3.1 is available.You should consider upgrading via the 'C:\Users\virtual.SYSPROGS\AppData\Local\VisualGDB\Python3\python.exe -m pip install --upgrade pip' command.--------------------------Command exited with code 1
Take a note of the following parameters:
- Python executable used to run the command (in this example, C:\Users\virtual.SYSPROGS\AppData\Local\VisualGDB\Python3\python.exe)
- The requirements file (in this example, c:\projects\temp\MbedProject2\mbed-os\requirements.txt)
- The exact package versions that failed (in this example, pywin32==224) and the available versions (in this example, 225..302)
- In order to make that mbed version work, you will need to adjust the requirements.txt file to reference the nearest package version provided by your Python distro. In this example, it would mean replacing the following line in requirements.txt:
with the following one:
- Now you can re-run the “mbed update” command as shown in the log file, e.g.:
12cd c:\projects\temp\MbedProject2\mbed-osC:\Users\virtual.SYSPROGS\AppData\Local\VisualGDB\Python3\python.exe "C:\Users\virtual.SYSPROGS\AppData\Local\VisualGDB\Python3\lib\site-packages\mbed\mbed.py" update mbed-os-6.9.0
- Now you can import the manually patched mbed checkout into VisualGDB by selecting the “import” mode in the wizard: