-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
This is due to a "bug" in the Swift installation procedure for Windows 10. Below, after describing the issue, I have both a solution, and a request to change Swift - Getting Started. I am new at Swift, and other thoughts are welcome! And many thanks to all who helped bring Swift to Windows!!! :)
Environment
build number: Swift 5.6.1
OS: Windows 10 desktop computer
Issue Description (1 of 3)
On Windows 10, lldb gets error dialog: The code execution cannot proceed because python310.dll was not found.
Test Case
After an install of Swift on Windows 10, run 'lldb Factorial' as shown on Swift - Getting Started > Using the LLDB Debugger. That elicits the error above.
Cause
The instructions on Swift - Getting Started say to get Python 3.7.8, but the Swift-customized lldb needs 3.10.
Solution
Get the correct version of Python, as described below.
Suggested Documentation Fix
On Swift - Getting Started,
change all references to Python 3.7.8 to 3.10.4, including these:
- winget install Python.Python.3 --version 3.7.8150.0
- Python 3 64-bit (3.7.8)
- The windows binaries are built against Python 3.7.8
Issue Description (2 of 3)
Another issue is that Python is listed within the box under 'The following additional Visual Studio components are recommended', which uses Visual Studio Installer. But you can't get 3.10.4 from VS Installer because only older versions are offered there.
Suggested Documentation Fix
On Swift - Getting Started,
move the reference to Python from within the box to below the box, but still in the 'recommended' section.
Add that the developer should download and install Python 3.10.4, outside of Visual Studio Installer.
The link info is:
Python 3.10.4 (3/24/22)
python-3.10.4-amd64.exe (64-bit)
https://www.python.org/downloads/release/python-3104/
Also please add, under that, this text:
Python Installer Tips
- Unselect Install launcher
- Select Add to PATH
- Customize the install
- Unselect Documentation
- Select pip -- this will be needed below
- Unselect tcl/tk
- Unselect Python test suite
- Unselect py launcher
- Select Install for all users
- Select create shortcuts
- Select add python env vars
- Select precompile standard lib
When the install is complete, verify that the environment vars are set correctly:
PATH - the Python directory should be in here (you may want to move it down some, if it's only needed during the use of lldb). also, (Python-root)\Scripts should be in the PATH, just after the python directory, so that 'pip' is available (will be needed to get the 'six' module, described just below).
PYTHONHOME - should point to your Python root dir.
PYTHONPATH - should be: (your-Python-root)\Lib;(your-Python-root)\Lib\site-packages
Then, install the Python 'six' module, into the site-packages subdirectory. This is needed by lldb.
Start a Command Prompt, with Run as administrator. then do:
cd /d %PYTHONHOME%
pip install six
Issue Description (3 of 3)
Finally: I used the Traditional install method, not the Windows Package Manager method, so the following is not tested -- I suspect that changes are needed to those instructions to accommodate the fact that the Visual Studio Installer does not offer the needed version of Python.
Suggested Documentation Fix
Could someone please test the current Windows Package Manager method, verify that the needed Python version is not available with that tool, and fix those instructions for the WPM method as needed, following the notes above?